Use Select option with Builder-generated Options
Unlike picklist fields, which have a defined set of values, string fields have values unique to each record—for example, the list of cities where accounts are listed. To create a filter that includes all the unique values (without displaying duplicate values) for a string field, you need to pull those values together using an aggregate model.
Let's create a model that allows users to filter sales opportunities by the city in which the opportunity is located.
The goal? A filter that allows users to select from a list of string values, in this case, the city associated with the account.
Assumptions
The example below assumes a Nintex Apps page with:
-
a functioning model on an object that collects opportunity data. ( In this example, we use Salesforce's Opportunity object ).
-
a Table component that model with fields for:
- Name
- associated account, i.e. AccountID
- Amount
- Billing City
If using a different connection, the field names indicated may be different.
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
-
Field: The field that contains the record's city: BillingCity.
Note: Some opportunity objects do not include a field for city, but do include a city field for the account itself. In the fields list, click next to the account ID field to open the associated fields on the account object. Then select the appropriate "city" field.
-
Operator: =
-
Value: Leave blank
-
State:
- Condition state: Dynamic (Default off). ( Nintex Apps will automatically generate a name for the filter.)
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
On the Table component, click Add feature > Table filter, then configure the filter:
- Filter type: Select option
- Filter method: Server
- Pick options and condition: Manually
- Filter label: Filter by City
- Model condition to affect: The condition created (above).
- Create "None Selected" option: Checked
- "None Selected" option text: Select City
- Display as: Dropdown
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
Create a new aggregate model on the same object you want to filter, in this case, an Opportunity object. By aggregating on the object's data, the model creates a list of all the unique values used within the field, without duplicating any of those values. We then use this unique values list as the source for the filter.
In the model, leave the Max # of records property blank.
Group the model
Under Groupings select the Simple Grouping method. Then select the field to group by using the same field employed by the condition --Billing City. Once created, click that grouping item, and copy its Alias name from the properties pane. ( You'll need this for the filter source. )
Note: Aggregate models cannot be grouped by formula fields.
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
It's time to identify the source for the filter's menu options, so click the filter, then click
Add option source, then configure:- Source type: Rows in a model
- Merge source: Choose the aggregate model just created
- Option label template: of selecting the field from the field picker, use the Alias Name copied from the grouping. Enclose this name in triple curly brackets, like this {{{alias.name}}}
- Which conditions will this source's options affect?: Just the default condition
- Value to inject into default condition: Again, use the Alias Name enclosed in triple curly brackets: {{{alias.name}}}