Lookups define the way how to fill-in Drop-Down lists and how to translate id’s to names both in the user interface and business logic.
Lookups are the Swiss Army knife of the data model. Often you will need to get a list of values which can be entered to a field (e.g. in a drop-down list) or you need to look-up a value by a specified key (e.g. getting a customer’s name by providing an Id of his record). Data Lookups are the tool for getting this done.
Every data lookup provides 2 main features:
- List: Provides a list of values (so you can possibly pick one)
- Value: Gives a value depending on an Id passed (so you can display something understandable to the user when you have only Id)
Some data lookup consumers use both features (list and value), some use only one of them.
The Model elements which reference data lookups:
Entity Field (DefaultLookup attribute)
Data Structure Field (DefaultLookup attribute)
DropDown widget (Lookup attribute)
|Drop-Down Lists in GUI||Drop-Down lists are user controls that allow user to pick up a value from a list. They also display a current value instead of displaying an Id which is stored in the record's field. They use both Value and List features of Data Lookups
|Entity Model SQL||When designing reports, record Id's are usually NOT the data being displayed to the user. Instead, we want to display some understandable text. The Data Structure's UseLookupValue attribute or entity Lookup Field allow you to substitute the Id with a looked-up value directly in the database query by generating a SQL subquery. This way data structures can stay simple and data queries faster.
Data Structure lookup value substitution uses only the Value part of the lookup. It does not use the List part.
|Data Audit Log||When data auditing is enabled in the data entity, the data service stores an audit trail of all the changes that happened because of data editing done by the user or the workflow. When displaying the audit log, the user does not want to see which Id changed to another Id, he wants to see, what value was referenced by it at that time. Therefore before saving the audit record, the data service queries the lookup for the lookup value and stores that value into the audit together with the Id.
Auditing also uses only the Value part of the lookup. It does not use the List part.
|XSL Stylesheet Transformations in Workflows||
Sometimes data transformations require substituting Id's which arrive with the transformation data source with a looked-up value. A good example can be when we get a business case record and we need to generate an e-mail, knowing only customer's Id, stored in the business case.
The LookupOrCreate function allows you to create a record if it does not exist in a single statement.
The LookupValue uses the Value part of the lookup while the LookupList uses the List part of the lookup.
|AlwaysAllowReturnToForm||The Select and Return to <lookup page> button will be always shown even when the lookup list is filtered.|
|IsTree||Indicates that the lookup has a hierarchical structure. You have to specify the
|TreeParentMember||Specifies the field in the
A Reference to the data structure, using which the data for the lookup list will be loaded. The data will loaded from the root entity.
The LookupOrCreate this data structure is used for inserting data. For this work it has to have AllFields
|ListMethod||Specifies an optional filter set for the list part of the data lookup. If the filter contains parameters, these parameters must be provided when requesting the list. This happens e.g. by setting ParameterMappings in a DropDown widget.|
|ListSortSet||Optional sort set that will change the way how the data will be sorted when displayed using the Drop-Down list. By default the data are sorted by the first column alphabetically in an ascending order.|
|ListDisplayMember||Specifies a field from the
|ListValueMember||Specifies a field from the
|ValueDataStructure||Reference to the data structure, which will be used to look up a single value in the data source.|
Specifies a filter set for getting a single looked up value.
DATA MODEL USAGE
When the lookup is used in the data model (either as Lookup Field or in a data structure by setting
When used via LookupValue XSLT function you can have many parameters. Then you will use it to return a single value but using multiple parameters. If more than 1 value exists in the database, it always returns the TOP one. You can take advantage of using a
|ValueSortSet||Specifies a sort set by which the data should be sorted. Since only 1 value can be returned it is only useful if you know that there exist multiple results but you need to control which of them will be returned (e.g. the highest number).|
|ValueDisplayMember||Specifies a field from the
|ValueValueMember||not used at the moment|