Introduction

A change in behavior on the picker control has been introduced in K2 smartforms 1.0.4 (4.12165.1595.0) relating to values being transferred to the picker control.

New Behavior

In K2 smartforms 1.0.4, when values are transferred to the picker control only a value matching the identifier property will be loaded.  The picker will execute an “equals” query on this field and ignore the filter fields selected.  The value transferred will be attempted to be cast to the type of identifier field before the query is executed.  If the type is incorrect the picker control will show an error message at runtime as per the image below:


Image

To fix the above scenario in K2 smartforms 1.0.4, simply adjust the identifier for the picker control to the correct SmartObject property field used in the solution as per the image below:

Image

 

Alternatively the user can revert back to the previous behavior by adding the appSetting

Forms.Controls.Picker.SetValueUseContains to the web.config and setting it to true.  Note that this is not recommended.

 

Codeblock:

<configuration>

  <appSettings>

<add key="Forms.Controls.Picker.SetValueUseContains" value="true" />

  

Considerations

The Identifier should not be left on ID when it should be FullName or another field.  Existing data may contain names which would have loaded correctly in K2 smartforms 1.0.3, provided that the names where unique and not a subset of other names.  If the picker control was used to save the data then the ID would be saved and not the FullName

To fix the above scenario in K2 smartforms 1.0.4, simply adjust the identifier for the picker control to FullName .

 

Previous Behavior

In K2 smartforms 1.0.3 incorrect values could be loaded in the picker control that matched a subset of the value that was transferred.  

Example 1

If the list of values that the picker control was bound to contained 100 and 10, and a value of 10 was transferred to the picker control, the order of the listed values would determine whether 10 or 100 was resolved.  If 100 was listed in the data before 10 then 100 would load as the resolved value as it matches 10.  If 10 was listed before 100 then 10 would load as the resolved value.

Example 2

If the list of values that the picker control was bound to contain Bobby and Bob, and a value of Bob was transferred to the picker control, the order of the listed values would determine whether Bob or Bobby is resolved.  If Bobby is listed in the data before Bob then Bobby would load as the resolved value as it matches Bob.  If Bob was listed before Bobby then Bob would load as the resolved value.