Hi All,
I want to query on the result set obtained from a select service. Do we have any service which can give a specialized result set based on a condition.
For example:
Let us have a select statment which selects “School”, “Class”, “Roll No” and “Name” fields from a database based on the condition School =“PUBLIC SCHOOL”.
On executing the query we will get the details of the students studying in “PUBLIC SCHOOL”. The requirement is to querry the result set and find out all the students who belongs to “Class 1”.
This can be done using a loop and branch conditions but is there any service provided by webMethods to just querry on a list of documents to find out the specific documents satisfying a given condition.
Thanks,
Deepak.
HI Deepak:
Not sure of your exact implementation but it may be as simple as just placing a filter on your triggered document while in the developer tool?
From the help “ontopic” in the developer tool is the following description of the functionality…
Building Trigger Conditions
The lower half of the editor displays information about the condition selected in the upper half of the editor. Use the editor to build conditions.
Name
Displays the name of the condition.
Service
Enter the fully qualified name of the service to be invoked by the Integration Server when it receives one or more documents that satisfy the trigger condition, or use the browse button to select the service.
Document Type
Select or enter the names of the publishable document types to which you want the trigger to subscribe. You can add one or more publishable document types by using the create button . in the toolbar. To change an already existing document type, click next to the Document Type column.
Filter
Enter a filter, which determines the criteria that you want the Integration Server to apply to each instance of this publishable document type. Use the browse button next to the Filter column to specify or edit a filter.
Join Type
Select the specified join type for the trigger condition. The join type determines what action the Integration Server takes if it receives all, any, or only one of the specified documents. Note that a trigger can contain only one join condition. These options are enabled only when you have specified more than one publishable document type.
HTH,
Randy N.
Hi Deepak,
I don’t think that there is a generic service for accomplishing what you request. However there are two other approaches other than the ones provided so far:
a) You have control over the select statement, e.g. you can modify it.
If this is the case, the most efficient way to get the filtered results is to add an additional clause to your where statement, where you filter out the values in the select operation. Just add ‘and class LIKE ?’ to your query. If you in other instances do not want to filter for a specific class, just provide with a wildcard to this field (if you are using Oracle, the wild card is %_% and requires that you use LIKE and not =).
b) If you cannot change the select statement, a different method for filtering for your needs is using WQL or XQL. The procedure is take the document, run documentToXMLString, → XMLStringToXMLNode → queryXMLNode.
In the Variables Tab of the queryXMLNode service, create a document looking like your select output document (sadly enough, you cannot use the document reference feature here). In the document list element you add filter for example //results[./class=‘2006’] in the query textbox, whilst marking the document list type in your recently created document. This queries the document only for elements with the value of 2006 in the class element. The next step is to map each field that you want as output. For each variable type of you can enter // School, // Class and so on to map the select output fields to the fields in the document created in your queryXMLNode service. The syntax provided is using XQL, if you want to use WQL, please check the IntegrationServerBISReference.pdf for more info.
Regards
/Brook