Custom Column Error

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

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Custom Column Error

Postby Bill_Balas » Fri Feb 10, 2017 10:21 pm

Hello,

upon creating a column with this code, I'm getting a "The statement is not valid SQL" pop-up.
It translates the "NOT (Connectedness on Turn Any Made Straight is Possible)" filter.

Would you take a look, please?

Thanks

CODE:
sum(if[(((NOT (((((cash_hand_summary.card_4 > 0 and ((0 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND ((1 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (2 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 3 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 4 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13))) OR (2 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (3 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 4 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13))) OR (3 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND 4 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)) OR (12 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (11 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 10 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 9 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13))) OR (11 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (10 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) OR 9 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13))) OR (10 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND 9 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)))) OR (0 not in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (((cash_hand_summary.card_1 % 13) + 4 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 3) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 3) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 3))) OR ((cash_hand_summary.card_1 % 13) + 3 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 2) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 2) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_1 % 13) + 1 AND (cash_hand_summary.card_1 % 13) + 2))) OR ((cash_hand_summary.card_1 % 13) + 2 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (cash_hand_summary.card_2 % 13 = (cash_hand_summary.card_1 % 13) + 1 OR cash_hand_summary.card_3 % 13 = (cash_hand_summary.card_1 % 13) + 1 OR cash_hand_summary.card_4 % 13 = (cash_hand_summary.card_1 % 13) + 1)) OR ((cash_hand_summary.card_2 % 13) + 4 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 3) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 3) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 3))) OR ((cash_hand_summary.card_2 % 13) + 3 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 2) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 2) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_2 % 13) + 1 AND (cash_hand_summary.card_2 % 13) + 2))) OR ((cash_hand_summary.card_2 % 13) + 2 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13) AND (cash_hand_summary.card_1 % 13 = (cash_hand_summary.card_2 % 13) + 1 OR cash_hand_summary.card_3 % 13 = (cash_hand_summary.card_2 % 13) + 1 OR cash_hand_summary.card_4 % 13 = (cash_hand_summary.card_2 % 13) + 1)) OR ((cash_hand_summary.card_3 % 13) + 4 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_1 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 3) OR (cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 3) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 3))) OR ((cash_hand_summary.card_3 % 13) + 3 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_1 % 13, cash_hand_summary.card_4 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 2) OR (cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 2) OR (cash_hand_summary.card_4 % 13 BETWEEN (cash_hand_summary.card_3 % 13) + 1 AND (cash_hand_summary.card_3 % 13) + 2))) OR ((cash_hand_summary.card_3 % 13) + 2 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_1 % 13, cash_hand_summary.card_4 % 13) AND (cash_hand_summary.card_2 % 13 = (cash_hand_summary.card_3 % 13) + 1 OR cash_hand_summary.card_1 % 13 = (cash_hand_summary.card_3 % 13) + 1 OR cash_hand_summary.card_4 % 13 = (cash_hand_summary.card_3 % 13) + 1)) OR ((cash_hand_summary.card_4 % 13) + 4 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_1 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 3) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 3) OR (cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 3))) OR ((cash_hand_summary.card_4 % 13) + 3 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_1 % 13) AND ((cash_hand_summary.card_2 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 2) OR (cash_hand_summary.card_3 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 2) OR (cash_hand_summary.card_1 % 13 BETWEEN (cash_hand_summary.card_4 % 13) + 1 AND (cash_hand_summary.card_4 % 13) + 2))) OR ((cash_hand_summary.card_4 % 13) + 2 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_1 % 13) AND (cash_hand_summary.card_2 % 13 = (cash_hand_summary.card_4 % 13) + 1 OR cash_hand_summary.card_3 % 13 = (cash_hand_summary.card_4 % 13) + 1 OR cash_hand_summary.card_1 % 13 = (cash_hand_summary.card_4 % 13) + 1))))))))))))), 1, 0])
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Custom Column Error

Postby WhiteRider » Sat Feb 11, 2017 5:00 am

You can't use "in" in column expressions because the commas cause complications. You will need to test the values explicitly with equals, less than, greater than, between, etc.
WhiteRider
Moderator
 
Posts: 53987
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Custom Column Error

Postby Bill_Balas » Sat Feb 11, 2017 2:48 pm

Ok, thanks. My ability to reconfigure this string is limited. Would you be able to exemplify?

Thank you
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Custom Column Error

Postby WhiteRider » Sat Feb 11, 2017 4:25 pm

I'm not at my normal computer right now so I can't do it for you, but I'd keep removing parts until I got it to validate, and then add sections back in to narrow down the part where the problem occurs. Alternatively start with a small part of it to make sure the basic building block is ok and then again add in parts until it stops validating.
WhiteRider
Moderator
 
Posts: 53987
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Custom Column Error

Postby Bill_Balas » Sat Feb 11, 2017 6:23 pm

Thanks for the perspective.
Please help me understand a couple of code sections. Considering,

A) (original code section):
(cash_hand_summary.card_4 > 0 and ((0 in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13))))

B) (custom code section):
(cash_hand_summary.card_4 > 0 AND (cash_hand_summary.card_1 % 13 = 0 AND cash_hand_summary.card_2 % 13 = 0 AND cash_hand_summary.card_3 % 13 = 0 cash_hand_summary.card_4 % 13 =0))

Despite not being "valid SQL", is the B) code an accurate translation of the original code A)?


Considering, (cash_hand_summary.card_1 % 13 = (cash_hand_summary.card_2 % 13) + 1, is this section indicating the 1st and 2nd Flop cards are sequenced, like 67 or JQ?

Thanks
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Custom Column Error

Postby WhiteRider » Sun Feb 12, 2017 5:33 am

You need to use 'OR' instead of 'AND' in:
(cash_hand_summary.card_1 % 13 = 0 AND cash_hand_summary.card_2 % 13 = 0 AND cash_hand_summary.card_3 % 13 = 0 cash_hand_summary.card_4 % 13 =0)
..if you want to test for any of them matching (which is what 'in' does).

Bill_Balas wrote:Considering, (cash_hand_summary.card_1 % 13 = (cash_hand_summary.card_2 % 13) + 1, is this section indicating the 1st and 2nd Flop cards are sequenced, like 67 or JQ?

Yes, although you may need to do some extra tests for sequenced aces, and you'll also want to test for "-1" as well as "+1" in order to catch 76 as well as 67.
WhiteRider
Moderator
 
Posts: 53987
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Custom Column Error

Postby Bill_Balas » Mon Feb 13, 2017 7:56 pm

Ok, thanks. And hopefully the last question... are these 2 transformations correct?:

OR (0 not in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)

to

OR (cash_hand_summary.card_1 % 13>=1 OR cash_hand_summary.card_2 % 13>=1 OR cash_hand_summary.card_3 % 13>=1 OR cash_hand_summary.card_4 % 13>=1)


...&...


AND (((cash_hand_summary.card_1 % 13) + 4 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)

to

AND (((cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_2 % 13=0) OR
(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_3 % 13=0) OR
(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_4 % 13=0)))



Thanks
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Custom Column Error

Postby WhiteRider » Tue Feb 14, 2017 4:22 am

Bill_Balas wrote:OR (0 not in (cash_hand_summary.card_1 % 13, cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)

to

OR (cash_hand_summary.card_1 % 13>=1 OR cash_hand_summary.card_2 % 13>=1 OR cash_hand_summary.card_3 % 13>=1 OR cash_hand_summary.card_4 % 13>=1)

For 'not in' you'll need to use AND in this case because you want to test for all of them not matching 0.

Bill_Balas wrote:AND (((cash_hand_summary.card_1 % 13) + 4 in (cash_hand_summary.card_2 % 13, cash_hand_summary.card_3 % 13, cash_hand_summary.card_4 % 13)

to

AND (((cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_2 % 13=0) OR
(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_3 % 13=0) OR
(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_4 % 13=0)))

"(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_2 % 13=0)" isn't valid - you're not comparing the first part numerically (you're not using = or greater than/less than for example).
Instead of "(cash_hand_summary.card_1 % 13) + 4 AND (cash_hand_summary.card_2 % 13=0)" use "(cash_hand_summary.card_1 % 13) + 4 = (cash_hand_summary.card_2 % 13)"
WhiteRider
Moderator
 
Posts: 53987
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Custom Column Error

Postby Bill_Balas » Sat Feb 18, 2017 2:56 pm

Hello,

something not working on the code. Would you take a look at the attached file, please?
It's divided, section by section.

Thanks
Attachments
Code.zip
(12.28 KiB) Downloaded 46 times
Bill_Balas
 
Posts: 161
Joined: Wed Oct 22, 2014 8:57 pm

Re: Custom Column Error

Postby WhiteRider » Mon Feb 20, 2017 4:04 am

You still have "in" in the transformed code part and that won't work in column expressions. You also have at least one mismatched bracket over the whole expression, but that may be a factor of extracting things to separate lines.
WhiteRider
Moderator
 
Posts: 53987
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Next

Return to Custom Stats, Reports and HUD Profiles

Who is online

Users browsing this forum: No registered users and 37 guests

cron