Conditions in Text Formulas

The ternary operator (condition ? TrueValue : FalseValue) doesn’t appear to work in text fields. It should.

Also, we should be able to nest these, like this:

(condition1 ? (condition2 ? TrueValue2 : FalseValue2) : FalseValue1)

1 Like

It would be awesome to be able to put conditions on Text Formula fields. The current options are quite limiting. For example, in one of our Apps we have Companies which have multiple Contacts, although one Contact is always the Primary/Default Contact. On a table view, we would like to be able to only display the "Primary" contact, rather than showing ALL. However, it is not possible to do this and currently we have to show ALL connected Contacts (see screenshot)

We need to be able to either:

1) Put filters on Text Formula field (then we could set up a field on the Company object with a filter to only display Primary Contact, OR

2) Put filters on connected records when showing them in a table

Either way, Knack, would love to see this developed!

Another work around is first to create multiple short text fields, one for each possible condition.  Then create a "final" short text field that uses conditional rules to choose one of those other fields.

We really need this! When you need to show different text based on a value/date of another field.

This is the only work around for what you are looking for:

4.2. Conditional equations with text fields

Conditional rules don’t currently work with text fields, but you can map your text fields to number fields and use the number fields to in your equation. Assuming you already have a short text field called Text:

  1. Add a number field (we’ll call it Num)

  2. Add a conditional rule to the Num for each option you want to account for Text; e.g. set Num to 1 if Text is First Choice, set Num to 2 if Text is Second Choice, etc.

  3. Run a batch update on your data (even on

  4. a new temporary field) to populate the Num field via its conditional rules

  5. Use Num in place of Text in your equations

     

Here is the complete article: https://support.knack.com/hc/en-us/articles/226583228-Equations#conditional-equations

Basically what you will be doing is assigning numeric values to the possible text values in say a multiple choice drop down field (or any other field that can contain text), where the numeric value of the text field value will be held in a separate field in the same object.

The reason you have to do it this way is because you cannot use ternary operators (conditional logic) in a text formula field, and you cannot use text values in an equation field, so you need to assign numeric values to the text field values outside of the equation field to bridge the gap and use ternary operators with text values.

Is this true there are still NO conditional options for text formulas like there is for equations?

The ability to use conditional arguments in text formulas definitely has my vote!  Thx

Yes, I keep running into this!

+1

While the workaround is possible, it’s very cumbersome. This seems like a no-brainer for any database engine. Please add my vote to the list.