Stat Column error "The Statement is not valid SQL"

Discuss how to create custom stats, reports and HUD profiles and share your creations.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Stat Column error "The Statement is not valid SQL"

Postby Bill_Balas » Sat Jun 24, 2017 1:45 pm

Hello,

I'm getting a "The Statement is not valid SQL" popup, upon trying to save the following column. Can you help me correct it, please?
Please note the code is tested & works on "My Report/filters/edit expression filters" section.

Thanks

sum(if[(((((((case when(char_length(lookup_actions_f.action) < 1) then '' else (substring(lookup_actions_f.action from 1 for 1)) end) = 'X'))AND (((case when(char_length(lookup_actions_f.action) < 2) then '' else (substring(lookup_actions_f.action from 2 for 1)) end) = 'R')))))AND (((((cash_hand_summary.cnt_players_f BETWEEN 2 and 2)))))AND ((cash_hand_summary.card_1 > 0 and ((cash_hand_summary.card_1 % 13 = cash_hand_summary.card_2 % 13) OR (cash_hand_summary.card_1 % 13 = cash_hand_summary.card_3 % 13) OR (cash_hand_summary.card_2 % 13 = cash_hand_summary.card_3 % 13))))AND ((NOT (((((cash_hand_summary.card_1 > 0 and cash_hand_summary.card_1 % 13 = cash_hand_summary.card_2 % 13 and cash_hand_summary.card_2 % 13 = cash_hand_summary.card_3 % 13)))))))AND (((NOT (((((cash_hand_summary.card_1 % 13 != cash_hand_summary.card_2 % 13 and cash_hand_summary.card_1 % 13 != cash_hand_summary.card_3 % 13 and cash_hand_summary.card_2 % 13 != cash_hand_summary.card_3 % 13 and (((cash_hand_summary.card_1 % 13 = 0 OR cash_hand_summary.card_2 % 13 = 0 OR cash_hand_summary.card_3 % 13 = 0) AND ((cash_hand_summary.card_1 % 13 BETWEEN 0 and 4 and cash_hand_summary.card_2 % 13 BETWEEN 0 and 4 and cash_hand_summary.card_3 % 13 BETWEEN 0 and 4) OR ((cash_hand_summary.card_1 - 1) % 13 BETWEEN 8 and 12 and (cash_hand_summary.card_2 - 1) % 13 BETWEEN 8 and 12 and (cash_hand_summary.card_3 - 1 % 13 BETWEEN 8 and 12)))) OR (cash_hand_summary.card_2 % 13 BETWEEN ((cash_hand_summary.card_1 % 13) + 1) and ((cash_hand_summary.card_1 % 13) + 4) AND cash_hand_summary.card_3 % 13 BETWEEN ((cash_hand_summary.card_1 % 13) + 1) and ((cash_hand_summary.card_1 % 13) + 4)) OR (cash_hand_summary.card_1 % 13 BETWEEN ((cash_hand_summary.card_2 % 13) + 1) and ((cash_hand_summary.card_2 % 13) + 4) AND cash_hand_summary.card_3 % 13 BETWEEN ((cash_hand_summary.card_2 % 13) + 1) and ((cash_hand_summary.card_2 % 13) + 4)) OR (cash_hand_summary.card_2 % 13 BETWEEN ((cash_hand_summary.card_3 % 13) + 1) and ((cash_hand_summary.card_3 % 13) + 4) AND cash_hand_summary.card_1 % 13 BETWEEN ((cash_hand_summary.card_3 % 13) + 1) and ((cash_hand_summary.card_3 % 13) + 4))))))))))AND ((NOT (((((cash_hand_summary.card_1 > 0 and cash_hand_summary.card_1 - ((cash_hand_summary.card_1 - 1) % 13) = cash_hand_summary.card_2 - ((cash_hand_summary.card_2 - 1) % 13) and cash_hand_summary.card_2 - ((cash_hand_summary.card_2 - 1) % 13) = cash_hand_summary.card_3 - ((cash_hand_summary.card_3 - 1) % 13)))))))))AND ((NOT (((((length(cash_hand_summary.str_aggressors_p) = 1)))))))AND ((NOT (((((cash_hand_player_combinations.id_gametype = 1 and (cash_hand_player_combinations.flg_f_straight_draw OR cash_hand_player_combinations.flg_f_2gutshot_draw))))))))AND ((NOT (((((cash_hand_player_combinations.flg_f_flush_draw)))))))AND (((((cash_hand_player_statistics.flg_f_first)))))AND ((((((cash_hand_player_combinations.flg_f_threeoak AND cash_hand_player_combinations.val_f_hole_cards_used = 1 AND cash_hand_player_combinations.id_f_hand_strength BETWEEN 1 and 3)))))OR (((((cash_hand_player_combinations.flg_f_fullhouse and cash_hand_player_combinations.id_f_hand_strength BETWEEN 6 and 7)))))OR (((((cash_hand_player_combinations.flg_f_fullhouse AND cash_hand_player_combinations.id_f_hand_strength in (1,2,3,8,9)))))))AND (((((((cash_hand_player_statistics.flg_p_first_raise and cash_hand_player_statistics.flg_p_open_opp)))))AND (((case when(char_length(lookup_actions_p.action) < 1) then '' else (substring(lookup_actions_p.action from 1 for 1)) end) = 'R'))AND ((NOT ((lookup_actions_p.action LIKE '__%')))))OR ((((((cash_hand_player_statistics.cnt_p_face_limpers > 0)))))AND (((case when(char_length(lookup_actions_p.action) < 1) then '' else (substring(lookup_actions_p.action from 1 for 1)) end) = 'R'))AND ((NOT ((lookup_actions_p.action LIKE '__%'))))))AND ((cash_hand_player_statistics.val_f_bet_facing_pct BETWEEN 31.00 and 1000.00))AND ((((((lookup_actions_f.action LIKE '___%')))))OR (((((lookup_actions_t.action LIKE '_%'))))))), 1, 0])
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Stat Column error "The Statement is not valid SQL"

Postby WhiteRider » Mon Jun 26, 2017 2:18 am

That is because of the commas in the "in" part - they interfere with the parsing of the "if" statement and you will need to rewrite that part. You'll need to use a couple of 'between' statements or mathematical operators instead of the "in (1,2,3,8,9)".
WhiteRider
Moderator
 
Posts: 53972
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Stat Column error "The Statement is not valid SQL"

Postby BillGatesIII » Sun Jun 03, 2018 6:30 am

    An easier workaround is to use 'case when' instead of 'if[', like shown here.

    https://www.pokertracker.com/forums/viewtopic.php?f=61&t=92120&#p331309
    BillGatesIII
     
    Posts: 740
    Joined: Fri Dec 16, 2011 6:50 pm


    Return to Custom Stats, Reports and HUD Profiles

    Who is online

    Users browsing this forum: No registered users and 34 guests

    cron
    highfalutin