SearchTask (Integration function)
The SearchTask (Integration function) function allows you to query content from the Lobster Data Platform / Orchestration database (see Search API) in the mapping (phase 3) of a profile.
The search query is defined via the XML structure of a SearchTask object in parameter a, which can be built and tested interactively with the Search builder.
The XML structure can refer in the syntax @PARAM_X@ (with X from {B,C,D,E,F,G,H,I,J}) to the values of the optional parameters b-j from the function call.
Similarly, the syntax @VARIABLENNAME@ can be used to access the values of variables from the context of the profile.
The return value of the function is always the search result of a specific SearchResult object (SearchResult, TupleSearchResult or CsvSearchResult, see Search types) as text in XML format.
The optional parameter k can be used to parse this structure into a named DOM object, e.g. to evaluate this object with the function get value from XML () using XPath expressions.
Parameter
|
Parameter |
Description |
Example |
Note |
|
a |
XML structure of a SearchTask object |
SearchTask
<?xml version="1.0" encoding="UTF-8"?><core:SearchTask ... entity="base:User"> <base:LobsterDataLoginRequest userName="admin" selectedRole="1" selectedCompany="1"/> <core:TupleSearch> <core:SimplePropertySearch projection="address.name1" compareType="=="/> <core:PropertyProjection property="username"/> <groupBy/> </core:TupleSearch></core:SearchTask>
|
A 'query' can be created and tested interactively with the Search builder. The XML structure of the SearchTask object is then displayed in the XML tab. This query definition can then simply be pasted via the clipboard as a static value for parameter a and edited if necessary. Often – in contrast to the very simple example on the left – data from the runtime context in the profile must be included in the search so that it delivers the 'right' results. For this purpose, the XML can be applied to variables or parameters whose values are inserted at runtime from the context of the profile call. Especially for more complex application cases, it can be helpful to integrate the XML structure of the SearchTask object into the target structure of the profile, so that the 'search' can be linked to source data via mapping and dynamically constructed at runtime. Then parameter a is filled using the function create xml from node()(see a more detailed example below). Even then the XML definition can include parameters and variables. |
|
b-j |
Parameters which – similar to regular variables between two '@' characters – can be addressed in the XML definition of the search |
SearchTask
<?xml version="1.0" encoding="UTF-8"?><core:SearchTask ... entity="base:User"> <base:LobsterDataLoginRequest userName="admin" selectedRole="501" selectedCompany="@MSG_CALL_SCM_Company_id@"/> <core:TupleSearch> <core:SimplePropertySearch projection="@PARAM_B@" compareType="=="/> <core:PropertyProjection property="@PARAM_C@"/> <groupBy/> </core:TupleSearch></core:SearchTask>Based on the above example, parameters and variables were inserted here:
|
To get the same search results as in the static case above, the following conditions must be met:
|