webMethods Adapter for Terracotta DB Documentation 10.3 | webMethods Adapter for Terracotta DB Documentation | Adapter Services | Configuring Query Service
 
Configuring Query Service
A Query service retrieves the record based on a given key. The service retrieves all the records from the dataset if you do not provide a key value. You can configure Adapter for Terracotta DB services using Designer. For more information about adapter services, seeUsing Adapter Services.
Read the section Before Managing Adapter Services, before you configure adapter services.
* To configure an adapter service using the Query template
1. In Designer, right-click the folder in which the service is to be contained and select New > Adapter Service.
2. Select the parent namespace, type a name for the adapter service, and click Next.
3. Select webMethods Adapter for Terracotta DB as the adapter type and click Next.
4. Select the appropriate Adapter Connection Name and click Next.
5. From the list of available templates, select the Query template and click Finish.
The adapter service editor for the selected adapter service appears. You can select the Adapter Settings tab at any time to confirm adapter service properties such as the Adapter Name, Adapter Connection Name, and Adapter Service Template as necessary.
6. Select the Dataset tab to configure the following fields:
Field
Field Description/Action
Dataset Name
Specify the name of the dataset in TCStore.
Sampling Limit
Specify the number of records to be scanned to the metadata of the cells. These cell definitions are listed in the Query tab.
The Input values are integers and it must be greater than 0.
For example, if you provide sampling range as 10, then the service scans 10 records of the selected dataset and displays the cell definition for those 10 records.
Key Type
Specifies the key type which is auto populated based on the selected dataset.
Input Key Type
Specify the input key type.
7. Use the Select tab to define the cells that you need to retrieve from the dataset using the following fields:
a. Use the icon to create a new row as needed. You can use the icon to fill in all cell definitions that are retrieved by scanning the dataset for the specified Sampling Limit. Additionally, the second table will have the below fields with respect to the provided IS Document in the Dataset tab and the fields for the third table can be entered manually.
Use the following fields:
Field
Description/Action
Cell Name
Specifies the cell name in the record of a dataset.
If the Cell Name consist of (.), then it is considered as a separate field in an IS Document. All such selected cells are merged into an IS Document.
Cell Type
Specifies the cell type in the record of a dataset.
The supported data types are: INT, LONG, DOUBLE, STRING, CHAR, BOOL(Boolean), BYTES(byte array).
Output Field
Specifies the output field name.
Output Field Type
Specifies the data type of the output field.
Note: You must select the appropriate output field type to avoid conversion overflow.
Maximum Records
Specify the maximum number of records to be retrieved from a dataset. Set the value as 0, if you want to retrieve all the records from the dataset.
The default value is 10.
Note: Be sure to have unique cells across the tables in the Select tab.
8. Use the Filter tab to filter records matching the specified conditions:
a. Use the icon to create a new row as needed.
Use the following fields to specify the conditions:
Field
Description/Action
Parameter
The filter parameter is a number which is automatically generated.
Cell Name
Specifies the name of the cell in the record of a dataset.
Relational Operator
Specifies the operation performed on a cell.
The supported operations are: =, <, >, >=, <=, !=
Input Field
Specifies the input field name.
Cell Type
Specifies the type of the cell in the record of a dataset.
The supported data types are: INT, LONG, DOUBLE, STRING, CHAR, BOOL(Boolean), BYTES(byte array).
Input Field Type
Specifies the data type of the input field.
Note: The result is not guaranteed for any operators along with =(equals) for the Date input field type.
Filter Condition Name
Specifies the name of the filter condition .
9. Use the Operands tab to define aggregate filter conditions using the following fields:
a. Use the icon to create a new row as needed.
Use the following fields:
Field
Description/Action
Filter Condition Name
Specifies the name given for the filter condition which is provided in the Filter tab.
AND/OR
Specifies the logical operator.
Result
Specifies the result of the logical operation.
Note: The resulting value can be used as an operand for other filter conditions.
For example, to use an aggregate filter condition such as ( (Cond1 && Cond2) && (Cond5 && Cond6) ) && (Cond3 || Cond4), where cond1 to cond6 are the filter condition names defined in the Filter tab can be represented as shown below:
Cond1 and Cond2 = result1
Cond3 or Cond4 = result2
Cond5 and Cond6 = result3
result1 and result3 = result4
result4 or result2 = result6
10. To verify input or output information for the service, use the Input/Output tab as required.
The below field is auto generated under input section of Input/Output tab:
Field
Description/Action
key (Optional)
Specify the key of the Record.
value
Specifies the document which contains fields that needs to be queried.
$datasetName
Specify the dataset name. Optional field, where the specified value overrides the configured value in the Dataset tab.
The below field is auto generated under output section of Input/Output tab:
Field
Description/Action
results
Specifies a list of key value pairs, where the value contains list of cell names versus cell values .
11. From the File menu, select Save.
This service displays the result as a list of key value pairs where the value is a document which contains the cell names with their corresponding values.
Note: You can retrieve the cells with similar names but with different data types from a dataset by providing different Output Field names.
To retrieve the entire IS Document in a cell, perform the following:
*You can retrieve the entire IS Document that is stored as a string in TCStore. For this, you have to select the Output Field Type as IData. When the Cell Type is a string and the Output Field Type is an IData, the Adapter for Terracotta DB converts the JSON string to IS Document.
*You can retrieve the entire IS Document that is stored as bytes in TCStore. For this, you have to select the Output Field Type as IData. When the cell Type is bytes and the Output Field Type is an IData, the Adapter for Terracotta DB converts the bytes to IS Document.
Note: The execution of Adapter service can fail with AdapterConnectionException, if a server connection is lost or refreshed when the TCDB server is restarted. In such circumstances, a retry of service execution or inspection of the state on reconnecting is required to determine the effect of the abandoned operation.

Copyright © 2017 - 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.