When defining a lookup, a default sort order is applied to the browse window which is carried through to the display in the UI after the values have been selected and saved.
The inclusion of a Lookup Parameter Mapping upon an attribute causes the sort ordering of selected and saved values to show in order of the hidden key (usually a numeric ID) values instead. This is when the lookup contains references such as @where:param:user_def:string:somelabel@ and then this parameter 'somelabel' is mapped to another attribute value available to the object.
Steps to Reproduce:
- Admin Tool > Lookups Create a new lookup called mvlparamtest, set source to Dynamic Query, and Submit.
- Use the following NSQL to create the lookup.
The configuration of the NSQL statement will automatically set the Hidden Key field to 'id' and the Name field to 'name' based on the NSQL Select field #1 and #2.
select @select:v.id:id@, @select:v.name:name@ from ( select '3' as name, 1 as id from dual union all select '1' as test, 2 as id from dual union all select '2' as test, 3 as id from dual union all select 'b' as test, 6 as id from dual union all select 'a' as test, 5 as id from dual union all select 'c' as test, 4 as id from dual ) v where (@where:param:user_def:string:dummy_param@ is null or 1=1) and @filter@
- Create a new project attribute with these values and click Save:
Name: mvlmapped ID: mvlmapped Data Type: Multi Valued Lookup Lookup: mvlparamtest
- A new section appears: Lookup Parameter Mappings. Under Object Attribute ID select 'manager_id' and click 'Save and Return' button.
- Add the attribute to the Project Properties [Layout: Edit] view, section General.
- Main Application > Projects > Navigate to and select or create a project.
- Browse and select all values and click 'Add' button.
Note: Items listed in the 'Browse Window' are sorted according to the configuration of the Browse Window properties defined on the Lookup Definition.
Before you click 'Save' on the project property subpage, you can see the values appear in the same order shown on the Lookup Browse Window.
- Click 'Save' button on the project property subpage - now you will see the items are sorted differently.
Expected Result: To see saved items sorted by name (a, b, c, 1, 2, 3)
Actual Result: Saved items are sorted by the internal ID (hidden key) value (3, 1, 2, c, a, b)
No workaround for displaying the items in a different order on the property subpage configuration.
However, if the field is placed on a List View, configured as a browse lookup, when the end-user clicks into the list of saved items, they are displayed in the order expected.
This issue has been documented as CLRT-41234.
Keywords: CLARITYKB, CLRT-41234, clarity13open, wnf, mvl