1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Copy Outcomes from one event to another

Discussion in 'Sportsbook Support' started by mouth, Apr 9, 2013.

  1. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    I am entering in all the round (18 of them) for a racing event, where the partipants are the same for each race. I would really like the ability to be able to copy the outcomes (description and odds) from one event to another, so that I do not have to enter in all 31 participants (outcomes) for each of the rounds (races).

    Since we don't have a copy functionality for this, could anyone please advise the SQL to achieve this? I'm sure it will just be a INSERT INTO xxx SET (xx,xx,xx) VALUES () type SQL? but not more forte enough to get it there.
     
  2. Bob

    Bob Developer Staff Member

    You can (in the current version) do it like below (I just ran the below one, so I know it works perfectly)

    event_id = the ID of the event the outcome will be associated with
    outcome_date = date the outcome was created (use the UNIX_TIMESTAMP format as shown below
    outcome_title = name of the outcome (255 characters MAX)
    current_odds_against = first number of the odds X/x
    current_odds_for = second number of the odds x/X

    NOTE: The last value line does NOT have a comma
    NOTE 2: Pay attention to the precise syntax below. Adding non text characters into the Title (such as ' marks will blow up if you don't properly escape them.. if you have a title with a ' mark, you must put a \ in front of it like this.. 'test insert don\'t hurt me outcome title 1'

    Code:
    INSERT INTO xf_nflj_sportsbook_outcome
        (event_id, outcome_date, outcome_title, current_odds_against, current_odds_for)
    VALUES
        (17, UNIX_TIMESTAMP('2013-04-09 12:00:00'), 'test insert outcome title 1', 2, 1),
        (17, UNIX_TIMESTAMP('2013-04-09 12:00:00'), 'test insert outcome title 2', 5, 1)
     
  3. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    Perfect, thanks!

    This is what I've utilised ...
    Code:
    INSERT INTO xf_nflj_sportsbook_outcome (event_id, outcome_date, outcome_title, current_odds_against, current_odds_for)
    SELECT '5', UNIX_TIMESTAMP(), outcome_title, current_odds_against, current_odds_for
    FROM xf_nflj_sportsbook_outcome
    WHERE event_id = 2;
    
    ... and just changing the '5' immediately after SELECT on the 2nd line each time I execute the SQL.
    Saved me heaps of time, thank-you :)
     
    Bob likes this.
  4. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    Now we have the appropriate SQL, we only need the UI for it :) ;)
     
  5. Bob

    Bob Developer Staff Member

    Its a little more complex for the next version of showcase as the outcome DW (data writer) has some preSave and postSave actions that now come into play (like updating the Events table with info).
     
  6. mouth

    mouth Member CAS Premium RMS Premium SC Premium UBS Premium Sportsbook

    Bump!
    Would like to see the ability to copy events (and it's outcomes) in the next version :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.