GetQueryById@1
Der Node GetQueryById@1 dient dazu, ein Abfrageergebnis anhand der Runtime-ID (RtId) der Abfrage aus dem OctoMesh Asset Repository abzurufen.
Abfragen dienen dazu, Daten anhand angegebener Kriterien aus dem OctoMesh Asset Repository abzurufen. Das Abfrageergebnis kann verwendet werden, um bestimmte Informationen aus dem Repository zu extrahieren und weiterzuverarbeiten oder zu analysieren.
Adapter-Voraussetzungen
Node-Konfiguration
Zu den Feldern targetPath, targetValueWriteMode und targetValueKind siehe Überblick. Das Feld path wird in diesem Node nicht verwendet.
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
fieldFilters:
- attributePath: rtId # The attribute path to filter
operator: Equals # The operator to use for filtering
comparisonValue: "6831724cb90d979b8ae5589b" # The value to compare against (when using a direct value)
comparisonValuePath: $.rtId # The value to compare against (when using a path)
Anwendungsbeispiel
Hier ein Beispiel, wie Sie den Node GetQueryById@1 in einer Transformations-Pipeline verwenden könnten. In diesem Beispiel ruft der Node eine Benachrichtigungsvorlage namens emaildemo ab und speichert den Textkörper der Vorlage in der Payload unter $.body und den Betreff unter $.subject.
Im Textkörper der Vorlage befinden sich zwei Platzhalter, tableData und firstName, die durch das Abfrageergebnis bzw. den Vornamen des Kunden ersetzt werden. Nach dem Ersetzen der Platzhalter wird die E-Mail an die angegebene E-Mail-Adresse gesendet.
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