Skip to main content

GetQueryById@1

Node GetQueryById@1 is used to retrieve a query result from the OctoMesh Asset Repository based on the query runtime ID (RtId).

Queries are used to retrieve data from the OctoMesh Asset Repository based on specified criteria. The query result can be used to extract specific information from the repository and perform further processing or analysis.

Adapter Prerequisites

Node Configuration

For fields targetPath, targetValueWriteMode, and targetValueKind, see Overview. Field path is not used in this node.

transformations:
- type: GetQueryById@1 # Get the query result
targetPath: $.query # Path where the query result should be stored in the payload
queryRtId: 673b5c06de73e7b1755754e4 # The runtime ID of the query
skip: 0 # The number of records to skip
take: 10 # The number of records to take, the default is 10

Usage Example

Here's an example of how you might use the GetQueryById@1 node in a transformation pipeline. In this example, the node retrieves a notification template named emaildemo and stores the template body in the payload at $.body and the subject at $.subject. There are two placeholders in the template body, tableData and firstName, which are replaced with the query result and the customer's first name, respectively. After replacing the placeholders, the email is sent to the specified email address.

triggers:
- type: FromExecutePipelineCommand@1
transformations:
- type: GetNotificationTemplate@1 # Get the notification template
notificationTemplateName: emaildemo
targetPath: body
subjectTargetPath: subject
- type: GetRtEntitiesById@1 # Get the customer entity
ckTypeId: OctoSdkDemo/Customer
rtIds:
- 673b5e451c7375d2ea2bec85
targetPath: $.customer
- type: GetQueryById@1 # Get the query result
targetPath: $.query
queryRtId: 673b5c06de73e7b1755754e4
- type: QueryResultToMarkdownTable@1 # Convert the query result to a Markdown table
path: $.query
targetPath: $.table
- type: PlaceholderReplace@1 # Replace placeholders in the notification template
replaceRules:
- placeholder: tableData
path: $.table
- placeholder: firstName
path: $.customer.Attributes.FirstName
- placeholder: lastName
path: $.customer.Attributes.LastName
path: $.body
targetPath: $.resultBody
- type: SetPrimitiveValue@1 # Set the email address
value: "demo@demo.com"
targetPath: $.to
- type: SendEMail@1 # Send the email
serverConfiguration: smtptest
subjectPath: $.subject
path: $.resultBody
toPath: $.to