Jump to content
  • 0

[FYI] How Conditions(CASE WHEN) is validated


Wikiwi

Question

This is not really a question, just wanted to share what I found out when experimenting with calculated fields, calculated values, and formula fields.

Basically when you created a formula that contains conditions the system pulls the first record in your table and run those fields in your condition and if that doesn't encounter an error then the formula is considered "valid".

As an example, lets say you have 2 date fields  (Date_1  and Date_2) and you used this fields in the formula below

CASE

WHEN [@field:Date_1 ]  = [@field:Date_2] THEN 1

WHEN [@field:Date_1 ]  < [@field:Date_2] THEN 2

ELSE 1/0

If your source table doesn't have any records the formula will be valid since  'null' is equals to 'null' and the 1st WHEN condition is satisfied.

If your source table have records and Date_1 is equals to  Date_2 then the formula is still valid since it satisfies the 1st WHEN condition

If your source table have records and Date_1 is less than Date_2 then the formula is still valid since it satisfies the 2nd WHEN condition

if your source table have records and Date_1 is not equals, or not less than Date_2 then the formula will encounter an error since this will fall to the ELSE condition, and 1/0 is a mathematical error.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...