Page 1 of 1

Invalid SQL?

PostPosted: Sun Apr 16, 2023 7:55 pm
by lavis
I don't understand why this doesn't work.

I have a custom "Players" column named val_last_aggressor_p defined as:
Code: Select all
RIGHT(cash_hand_summary.str_aggressors_p, 1)


Now I want to create another column named str_last_aggressor_p for formatting purposes.
The following expression is accepted as valid:
Code: Select all
val_p_last_aggressor = '0'

but if I change it to
Code: Select all
if[val_p_last_aggressor = '0', 'BTN', 'Other']

it gives me an invalid SQL error.

What gives?

Re: Invalid SQL?

PostPosted: Sun Apr 16, 2023 9:55 pm
by lavis
I'm noticing now that my naming here is inconsistent, but the point stands. I've since renamed the columns to str_last_aggressor_p and str_last_aggressor_p_pos with the same issue.

Re: Invalid SQL?

PostPosted: Mon Apr 17, 2023 11:05 am
by Flag_Hippo
lavis wrote:Now I want to create another column named str_last_aggressor_p for formatting purposes.
The following expression is accepted as valid:
Code: Select all
val_p_last_aggressor = '0'

but if I change it to
Code: Select all
if[val_p_last_aggressor = '0', 'BTN', 'Other']

it gives me an invalid SQL error.

Formatting isn't done within the column expression but there is a 'Format Type:' option on the 'Stats - Definition' tab where formatting can be specified. You will also need to use () brackets there and not [] brackets - see this guide for some formatting examples.

Re: Invalid SQL?

PostPosted: Mon Apr 17, 2023 12:30 pm
by lavis
Thanks, yeah, I figured it out. But I'm still curious why this isn't valid? Can you not define a column using if statements involving other custom columns?

Re: Invalid SQL?

PostPosted: Tue Apr 18, 2023 2:38 am
by Flag_Hippo
Unfortunately you can't reference columns within other columns.