Conditional Relations

Create relationships only in certain conditions.

When you configure componentscomputed columns, or conditions, you're always dealing with values. The If → Then → Else Column allows you to produce new values based on a set of conditions.

The If -> Then -> Else column configuration.

The simplest and most common way to use this column is to test for a value and then output a Custom Value. For example: "if the value in the Price column is below 10 then output the value low."

However, each case's output value can also be a Column Value. There are many reasons and use cases for this, but let's look at two of the most common.

Outputting a value for a relation

For example, this app has an If → Then → Else Column which tests for the custom value of true and then outputs a column value from the row that is being evaluated.

In other words, if an item is active then the Property ID will be shown. You can then use that value elsewhere, like in a further Relation. Your new relation will only pull back those rows that have values in them.

Outputting a value for a calculation

Another example would be in a calculation. Say you had an inventory log, with sales items out and restocking items in, and we wanted to sum the total of all the sold items in the log (but not the restocking items).

To do this, you can create an If → Then → Else column that will show the order total only if the Sale or Restock column contains the value 'Sale' and will show the value of 0 if not. You can then use that column elsewhere in a calculation, rollup, or chart.

Have a question about Conditional Relations? Ask the Glide community.

Updated more than a week ago
Was this article helpful?