Case Statement in model
Hello!
Wondering if someone could help me with a case statement that i have been unsuccessful with and have tried it many ways... Any help would be greatly appreciated.
Case(
[SGBSTDN_TERM_CODE_ADMIT] between 201650 and 201940,
"6th Year",
[SGBSTDN_TERM_CODE_ADMIT] between 201950 and 202040,
"5th Year",
[SGBSTDN_TERM_CODE_ADMIT] between 202050 and 202140,
"4th Year",
[SGBSTDN_TERM_CODE_ADMIT] between 202150 and 202240,
"3rd Year",
[SGBSTDN_TERM_CODE_ADMIT] between 202250 and 202340,
"2nd Year",
[SGBSTDN_TERM_CODE_ADMIT] between 202350 and 202440,
"1st Year", "Missing Year"
)
8 replies
-
Hi ,
Your syntax is incorrect for the PQL CASE() statement. See the Help page for detailed syntax, but your example correctly specified in Pyramid would be :
Case(
Criteria(
[SGBSTDN_TERM_CODE_ADMIT] >= 201650 && [SGBSTDN_TERM_CODE_ADMIT] <= 201940,
[SGBSTDN_TERM_CODE_ADMIT] >= 201950 && [SGBSTDN_TERM_CODE_ADMIT] <= 202040,
[SGBSTDN_TERM_CODE_ADMIT] >= 202050 && [SGBSTDN_TERM_CODE_ADMIT] <= 202140,
[SGBSTDN_TERM_CODE_ADMIT] >= 202150 && [SGBSTDN_TERM_CODE_ADMIT] <= 202240,
[SGBSTDN_TERM_CODE_ADMIT] >= 202250 && [SGBSTDN_TERM_CODE_ADMIT] <= 202340,
[SGBSTDN_TERM_CODE_ADMIT] >= 202350 && [SGBSTDN_TERM_CODE_ADMIT] <= 202440),
CriteriaResults(
“6th Year”,
“5th Year”,
“4th Year”,
“3rd Year”,
“2nd Year”,
“1st Year”),
“Missing Year”
)
Hope that helps!
Ian
-
If you are creating a custom column the case syntax is...
Case([SGBSTDN_TERM_CODE_ADMIT] >="201650" and [SGBSTDN_TERM_CODE_ADMIT] <= "201940","6th Year",
[SGBSTDN_TERM_CODE_ADMIT] >="201950" and [SGBSTDN_TERM_CODE_ADMIT] <= "202040","5th Year",
[SGBSTDN_TERM_CODE_ADMIT] >="202050" and [SGBSTDN_TERM_CODE_ADMIT] < "202140","4th Year",
[SGBSTDN_TERM_CODE_ADMIT] >="202150" and [SGBSTDN_TERM_CODE_ADMIT] < "202240","3rd Year",
[SGBSTDN_TERM_CODE_ADMIT] >="202250" and [SGBSTDN_TERM_CODE_ADMIT] < "202340","2nd Year",
[SGBSTDN_TERM_CODE_ADMIT] >="202350" and [SGBSTDN_TERM_CODE_ADMIT] < "202440","1st Year",
"Missing Year") -
Thank you! Question. Is there a way to create a statement with a sum if or sum attached. I have a table that has for instance an ID with multiple amounts associate with one ID, I'd like to sum the total for each ID that way I can join the tables.
Thanks again for all of your help!