Tom Azernour avatar
Written by Tom Azernour
Updated over a week ago

Type: Function

Function: IF

Syntax: IF(condition, value_if_true, [value_if_false]) or alternatively the shorthand version condition ? value_if_true : value_if_false

Description: If the first argument evaluates to true then it returns the second argument, otherwise it returns the third argument (or null if none is provided). The second and the third arguments must have the same type.

Sample usage:

  • IF(updated_at > created_at, updated_at, created_at) will always return updated_at by definition

  • IF(1 > 2, "some result")returns null

  • lines_changed > 500 ? "Big PR" : "Small PR" returns “Big PR” for all pull requests with more than 500 lines of code changed and “Small PR” otherwise.

  • IF(CONTAINS(label_names, ["defect", "bug", "fix"]), "Bug ", "Feature") returns Bug if one of the defined labels is found, otherwise returns Feature. This is used to remap fields.

Did this answer your question?