The Picker is an input control used to enter a search string which then returns search results according to filtered properties. The functionality of the Picker control is similar to the Lookup control, but the user has the ability to select multiple values and is able to search for specific values.
When using the Picker control, the ability to search for items is available at runtime. Items can be searched for in one of two ways. Using the Resolve function or using the Search function.
When using the Resolve function, follow the steps below and indicated in the image:
Multiple items can be added if the control was configured as such. An item can also be removed from this menu and the Search function can be accessed from here as well.
When using the Search function, follow the steps below and indicated in the image:
Multiple items can be added if the control was configured as such.
An example would look as follows:
The Picker control is available in the Input section of the Controls found in the View Designer and Form Designer.
Properties | Description | Can be set in runtime using Rules |
---|---|---|
Name | A unique identifier for the selected control. This property is required | No |
Field | A read-only property displaying the field that is bound to the selected control | No |
Data Type | A drop-down list containing the types of values that the selected control can accept | No |
Watermark | The text to display when the control is not populated | Yes, see Control Properties Actions for more information |
Tooltip | The value to be displayed when the cursor is hovered over the control during runtime | Yes, see Control Properties Actions for more information |
Save As XML | A Boolean value used to establish whether the results of a search should be saved in XML format | No |
Allow Multiple | A Boolean value used to establish whether the control accepts multiple values | No |
Delimiter | A character (or series of characters) that will be used to separate search results (will default to ; if no value is specified) | No |
Max Rows | A value between 1 and a 1000 that is used to enlarge the control’s editable area. Default is 1, type another value if required | Yes, see Control Properties Actions for more information |
Result Limit | Default is 100. This is the number of items to return per result set. The limit will override the page size if it is smaller than the page size. The limit is applied to transfer rules out of context of the resolving event. The limit is used when loading items | No |
Page Size | The number of search results to display per page (values between 1 and 99). Default is 10, type another value if required | No |
SmartObject | The selected SmartObject that has been bound to the control | No |
Method | The method to be used to populate the control | No |
Filter Properties | A list of the SmartObject properties that will be searched for the specified value | No |
Identifier | The SmartObject property that will be used as the value member of the control | No |
Display | The SmartObject property that will be used as the display member of the control | No |
Width | Adjust the width of the control (any whole percentage up to 100%, number or pixel value up to 32767px) | Yes, see Control Properties Actions for more information |
Tab Index | Used to define a sequence that users follow when they use the Tab key to navigate through a page at runtime | Yes, see Control Properties Actions for more information |
Visible | A Boolean value used to establish whether the control is visible during runtime | Yes, see Control Properties Actions for more information |
Enabled | A Boolean value used to establish whether the control is enabled during runtime | Yes, see Control Properties Actions for more information |
Read-Only | A Boolean value used to establish whether the control is read-only during runtime | Yes, see Control Properties Actions for more information |
Styles | Opens the Style Builder enabling the user to specify style features like Format, Font, Borders, Padding and Margins. See the Style Builder topic for more information on styling options | No |
Conditional Styles | Opens the Conditional Formatting Designer used to design styles that will apply only when certain conditions are met. See the Conditional Styles section for more information | No |
When clicking on the ellipsis next to SmartObject, the Configure Data Source screen opens. Configure the data source to be used. See the Input Mappings, Filters and Sorting section for more detail.
Fields | Description |
---|---|
SmartObject | The selected SmartObject that has been bound to the control |
Method | The method to be used to populate the control. |
Filter Properties | A list of the SmartObject properties that will be searched for the specified value |
Identifier | The SmartObject property that will be used as the value member of the control |
Display | The SmartObject property that will be used as the display member of the control |
Cache the data | When selected, the SmartObject data will be cached to allow for client side filtering enabling the data to be available offline. |
Filter the data according to another control's value | Another control's value can be used to filter the data returned |
Parent Control | The control that should be used to filter the values |
Parent Join Property | he SmartObject property on the parent SmartObject that will be used to join the original SmartObject with the current SmartObject |
Child Join Property | The SmartObject property on the current SmartObject that will be used to join the original SmartObject with the current SmartObject |
The option to cache the SmartObject data is available to allow for client side filtering. This is especially useful when using a SmartForm on a mobile device for example and data is required to be available offline. The control's dataset will be populated on initial load, any other changes to the underlying data source's data will not reflect in the current session until another server call is forced to update the dataset. To enable the caching of data, simply select the Cache the data option on the Configure Data Source screen.
It is important to note that the user is not required to configure anything except selecting the Cache the data option on the Configure Data Source screen to affect caching. The rules are automatically configured by the server. Designers can however remove these rules and place them somewhere else depending on their need. This is just an explanation of how caching is applied by the system.
Following is a diagram with an explanation of how the caching is applied in the background to enable client side filtering.
When selecting the Cache the data option on the Configure Data Source screen, the following two actions are automatically added to the View Initialize event;
Example:
If the option to filter according to another control was selected on the Configure Data Source screen together with the cache the data option, the following action is automatically added to the View Initialize event:
When clicking on the ellipsis next to Method on the Configure Data Source screen, the Populate Picker List Control with Data screen opens. The Picker control's input properties can be set by using fields or parameters. Filters and sorting can also be applied. This screen is the same as is used in the rule when using the resolving event, see the resolving event and method section below.
This feature now allows for cascading picker controls as the input mappings can be set based on the result of another picker control's values.The data in the Picker Control can be filtered according to another control's (Parent Control) value.
Filters and sorting can be applied to the results that will populate the Picker control. It is advised that a very strict filter is set up to limit the number of items used to populate the Picker control with. The Result Limit property of the Picker control is applied to this resultset as well (default is 100). See the Filters and Sorting section for a detailed description and items that need to be considered when applying these.
Rules can be created to populate the Picker control at runtime. The following rule definition can be used to execute the resolving event and populate the Picker control each time a data request is performed on the control:
Events: When a control raises an event (When Picker is resolving)
Actions: Populate a list control with data (asynchronously populate Picker list control with data)
The feature to allow a filtered dataset to be used to populate the Picker control can also be used without the resolving event.
To use this feature just add the populate action for the Picker control outside of the context of the resolving event. When this action is used without a Picker context then the Picker will be populated with all the results up the resolve limit. This is useful to pre populate a Picker with a list of items using filters /parameters. The following rule definition can be used for example:
Events: When a control raises an event (When Button is Clicked)
Actions: Populate a list control with data (then populate Picker list control with data)
The Picker Control has been enhanced with two methods namely the Load and Resolve methods. This functionality can be used to setup parameters and filtering on top of the standard Picker control behavior. The Resolve method will resolve the values as if they had been typed in and will build a query against all the selected filters instead of just on the identifier column. The Load method feature functions the same as a “data transfer” action however it will always load regardless if the control value is already the same firing the change event.
The Load method is used for dependent drop-downs (with Picker controls). A rule is automatically configured for the Load method where dependent Picker controls are used.
Data requests can occur in the following instances:
The web.config files can be found in the following locations:
C:\Program Files (x86)\K2 blackpearl\K2 smartforms Designer (Design time)
C:\Program Files (x86)\K2 blackpearl\K2 SmartForms Runtime (Runtime)
The following entry can be found in the web.config file. This entry is used to enable paging and is set to false by default. When changing the value to true, paging is enabled at runtime:
<add key="SmartObject.RuntimeListViewRowCount" value="false" />
It is important to note that changing this value to true will result in performance overhead. It is therefore advised not to change this setting when large amounts of data could potentially be returned
The following entry should be added to the web.config file if a contains filter should be used instead of an equals filter when loading data
<add key="Forms.Controls.Picker.SetValueUseContains" value="true" />
This entry should be added in the appsettings node. If this setting is not added, the equals filter will apply by default
In order to save multiple values, the option Save as XML has to be selected in the Details section of the Properties pane. This is however only possible if the backend SmartObject supports delimiters. In the case of CRM this is not possible and therefore the user needs to be familiar with the structure of the SmartObject with which they are integrating.
When selecting the Save as XML option in the properties of the control, the values selected in runtime will be saved in XML format in the database. This is particularly useful when changing controls where both controls are multiple selection controls. The Check Box List control is also a multiple selection control and the values selected in runtime is saved in XML format to the database. When changing controls between the Check Box List control and the Picker control, they will both be in XML format and no errors will be experienced. If the Picker control is not in XML format, the user will not be able to change the control to a Check Box List control. In the example below, the Mail_groups__xml_ field is saved as XML and the Sales_Regions field is NOT saved as XML.
Example of when the data is saved as XML in the database:
<collection>
<object parentid="57186152-eac8-41c2-8dbd-632f7d1b9279" parenttype="Object">
<fields>
<field name="ID"><value>8</value></field>
<field name="ID"><value>4</value></field>
<field name="ID"><value>1</value></field>
<field name="ID"><value>2</value></field>
<field name="ID"><value>3</value></field>
<field name="ID"><value>5</value></field>
<field name="ID"><value>6</value></field>
<field name="ID"><value>14</value></field>
<field name="ID"><value>9</value></field>
<field name="ID"><value>7</value></field>
</fields>
</object>
</collection>
Example of when the data is NOT saved as XML in the database:
8;4;1;2;3;5;6;14;9;7
When saving to XML, the data stored in XML format in the database can be used again in a Check Box List control a shown below:
And will be displayed as shown below:
For-Each looping rule conditions are available for use on List Views and list controls. For more information see the Rule Conditions topic.
How to use rules to change the edit state of View and Form controls and tables
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|