First, let me lay down how this is suppose to go in my app. There are 4 fields in question: SQFT, PPSQFT, SQFT_Override, PPSQFT_Override.
The most common case is going to be (SQFT * PPSQFT), which is a value for sqft * price per sqft. These values are automatically calculated from other fields. However, the user can 'Override' these values to output another number. So,
it would only be (SQFT * PPSQFT) if 'SQFT_Override' and 'PPSQFT_Override' both are blank, or null.
If 'PPSQFT_Override' is not null, it would be (SQFT * PPSQFT_Override).
If 'SQFT_Override' is not null, it would be (SQFT_Override * PPSQFT)
If 'SQFT_Override' and 'PPSQFT_Override' are both not null, it would be (SQFT_Override * PPSQFT_Override)
In formula terms, this is the closest I got:
CASE
WHEN [@field:PPSQFT_Override] is not null AND [@field:SQFT_Override] is not null
THEN [@field:SQFT_Override] * [@field:PPSQFT_Override]
ELSE WHEN [@field:PPSQFT_Override] is not null AND [@field:SQFT_Override] is null
THEN [@field:SQFT] * [@field:PPSQFT_Override]
ELSE [@field:SQFT] * [@field:PPSQFT]
END
Then I obviously found out that you cannot use 'Else When' or 'Else If' in CASE statements.
What is the best way to rewrite a CASE statement to include a third condition?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
kpcollier
I'm in need of some help with some CASE logic.
First, let me lay down how this is suppose to go in my app. There are 4 fields in question: SQFT, PPSQFT, SQFT_Override, PPSQFT_Override.
The most common case is going to be (SQFT * PPSQFT), which is a value for sqft * price per sqft. These values are automatically calculated from other fields. However, the user can 'Override' these values to output another number. So,
In formula terms, this is the closest I got:
CASE WHEN [@field:PPSQFT_Override] is not null AND [@field:SQFT_Override] is not null THEN [@field:SQFT_Override] * [@field:PPSQFT_Override] ELSE WHEN [@field:PPSQFT_Override] is not null AND [@field:SQFT_Override] is null THEN [@field:SQFT] * [@field:PPSQFT_Override] ELSE [@field:SQFT] * [@field:PPSQFT] END
Then I obviously found out that you cannot use 'Else When' or 'Else If' in CASE statements.
What is the best way to rewrite a CASE statement to include a third condition?
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.