Dependent Lookups
Introduction
In this article we will explore how to configure lookup fields on available on a Factorial Form to link them together.
In our example, we have 2 lookups, one that prompt the user to enter a Country and another that prompts the user to enter a State within that country.
Both of these fields are represented by a table in our Data Store, one with all the countries and one with all the states. The states are also a lookup from the state to the country that indicates that the state belongs to a specific country
Configuration
Configure the Country field
- On the Factorial Form, add a new Country field.
-
Under the Additional Properties, ensure that the following are correct:
- Business Object -> The external country table where the reference data resides
- Primary Key -> The name of the primary key field. This can be the same name as the Business Object or can be an id field
- Primary Field -> This is the friendly name that we want to display to the user on the external website
- Additional Display Attributes -> Any additional attributes that we may want to use for display rules on the form. In this example, we will leave this blank, but we will add them later on for more advanced queries

Configure the State field
The basics
- Add another field to the Factorial Form for State
-
Under the Additional Properties, ensure that the following are correct:
- Business Object -> The external country table where the reference data resides
- Primary Key -> The name of the primary key field. This can be the same name as the Business Object or can be an id field
- Primary Field -> This is the friendly name that we want to display to the user on the external website
- Additional Display Attributes -> We need to select the lookup field on the State table that points to the Country table. In this example, this foreign key is called "npo_countries", We will be using this in the query in a moment

The REST query
Next we need to update the REST Query This is more complicated. In the future we will simplify this form.
We will put our REST Query in the Additional REST query for retrieving the record set field.
For this to work, we need these values: 1. The schema name of the field we want to query on the target table. 1. In this example, the State (npo_state) table has a foreign key field called Country (npo_country). It is this npo_country field that we will query against 2. The Conditional Type 3. The compare value. This can either be a hard coded literal value, or an id of another field to search for
Accessing other fields on the source field
Often we want to access other fields on the source record. In this example, we may want to access the Iso2 code (npo_iso). We may also want to explicitly access the primary key or main friendly name.
To do this, we need to identify the following:
- Access the Primary Key, use the "Key" keyword
- Access the Primary Friendly Name, use the "Value" keyword
- Any other fields directly on this record, use the schema name of the field.
Examples
| Description | Example |
|---|---|
| Filter State field using the unique identifier from the Country field. This allows for dynamically filtered fields based on another field. For this we need to know the ID of the Country field on the Form. In this example, the Id is 90000000-2000-0000-0000-000000000001 We need to wrap the Id in double curly brackets to tell the processor to treat this like a variable |
npo_country eq {{90000000-2000-0000-0000-000000000001}} If the country is Australis and we search for "new": ![]() If the country is United States and we search for "new": ![]() |
| Find all the states in Australia. For this, we need to know the Id of the 'Australia' country record in the target Data Store For this example, the Id is '94dab19f-4b1d-ef11-840b-002248e352b4' |
npo_country eq '94dab19f-4b1d-ef11-840b-002248e352b4' |
| We have another country field that searches for countries that has a name that contains the Iso2 code of that country. See #Accessing other fields on the source field for why Value is used here For example, Australia is "AU" and United States is "US". We want to return countries with name that contains either of those, based on the original country field In this case, we want to make sure that we're including the "Additional Attribute" of Iso2 on the original Country field. This time, inside the double curly brackets, we want to provide the Id of the original country question, as before, but then add a dot and provide the schema name of the Iso2 field (npo_iso2) |
contains(Value,'{{90000000-2000-0000-0000-000000000001.npo_iso2code}}') |
| The Code field on the State matches the Iso2 Code of the country | npo_code eq {{90000000-2000-0000-0000-000000000001.npo_iso2code}} |

