SmartObject Wizard
When using SmartObject methods within a K2 Event, the SmartObject Wizard opens. The SmartObject Wizard provides the ability to specify parameters and filters. SmartObject Properties and SmartObject Method Parameters can be used to return data dynamically. Parameters and Properties can be required or optional. They are grouped together in the User Interface. Parameters are listed first, then properties. Parameters are dependent on the Service Object it is mapped to.
The SmartObject Filter feature has a big impact on reporting query performance as all records are not returned. If a Filter has been applied, records are filtered according to the filter criteria and only those records that comply are returned.
The Filter feature enables the user to specify a filter when using List Methods on a SmartObject. This feature is accessed when a user adds a SmartObject property to a K2 field in a wizard. Applying filters are optional.
Filtering depends on the Service Object, but the SmartObject Filter has a mechanism to apply filtering, even if the Service Object does not handle the filter. For native integrated services, the filter will apply as part of the generated SQL statement executed by the broker. For non integrated services, if the Service Object cannot implement the filter, the SmartObject server will apply the filter on the final result set of the data.
The following example shows how filters can be applied to the results of a SmartObject List method. Filters can be logically joined by using And and Or. Filters can also be grouped.
Order and List Options can be specified next to determine how the results should be returned.
Field | What it is |
---|---|
Order results by | Results can be ordered using a property and in a ascending or descending manner |
Return a single item |
First Item - The first item found when executing the query will be returned Last Item - The last item found when executing the query will be returned Index - Allows a specific field value to be returned. For example SMO.GetList returns four names: Joe, Bob, Sam and Tom. Index = 0 (Joe) Index = 1 (Bob) Index = 2 (Sam) Index = 3 (Tom) When specifying Index= 2, Sam will be returned Select one of the item options. If Index is selected specify an Index by dragging a Data Field or XML field from the Context Browser or typing an Index. |
Return all results that match filter | Returns all the results that match the filter when executing the query |
It is important to take note of the following when using the SmartObject Wizard which contains a Filter screen:
- Using Input Mappings is critical if a large number of records exist in the backend system. The more records you can filter-out before the results are returned to K2 the better the performance will be.
- If items are filtered out of the result set that is expected by using parameters, the filters applied on the Filters screen page may not work properly. As a troubleshooting tip, supply parameters only, look at the result set first, then go back and apply a filter to the result set that is returned.