Using unique fields for a data source question

Applies to Infiniti v9.0.0 or later
 

When not to use a unique field.

The unique value field defines which field to use to identify the selected record. This should be set to a field containing unique values, such as a primary key, e.g. ‘ClientID’.
 
Using a scenario where you want to build a repeating section that’s driven by an employee record using a data driven repeating section.

 
If you selected the First Name field as a unique value in the data source question. Because this isn’t a unique field as the data in the column can potentially be the same e.g. duplicate first names. You would get an inconsistent result and that’s because Infiniti is matching up the Rows with the First Name data fields.
 
In the design I have set the unique field to the First Name field (which is an incorrect set up). I’m using that Data Source to drive my employee details section and displaying the fields with labels.
 
 
At First load this loads as expected, the client IDs and first name are displayed correctly
 
 
However If you then change what employee records you want to bring back. The data driven repeating section will now be incorrect, order will be wrong and the employee names will match up against the wrong ID’s etc. The reason why this happens is because the data source is updating by a field that isn’t unique. The fix to this issue is changing the unique field to Employee ID as that is truly a unique field and the rows will update accordingly.
 
 

When to use a unique field.

Use a unique field if the data source results can change between runs. The default is to save a selected index which assumes the data is the same between runs. It is also the fastest as it doesn’t need to fetch the data while setting up the question. Unique fields saves the value of that column to the answer file, and when it is reloaded it will attempt to find the row that has that value again. Where ever it might now be.
 
Note: Remember a unique field must be truly unique there can’t be duplicates of the same value in the data field
 

Related Articles

Keywords

unique filed data source datasource question name