Zum Hauptinhalt springen

QueryResultToMarkdownTable@1

Der Node QueryResultToMarkdownTable@1 wird verwendet, um ein Abfrageergebnis in eine Markdown-Tabelle umzuwandeln. Dieser Node ist nützlich, wenn Sie das Abfrageergebnis im Markdown-Tabellenformat anzeigen möchten, zum Beispiel bei der Verwendung von Benachrichtigungen.

Adapter-Voraussetzungen​

Node-Konfiguration​

Für die Felder path, targetPath, targetValueWriteMode und targetValueKind siehe Überblick.

transformations:
- type: QueryResultToMarkdownTable@1 # Convert the query result to a Markdown table
path: $.query # Path to the query result
targetPath: $.table # Path to store the Markdown table

Verwendungsbeispiel​

Hier ist ein Beispiel dafür, wie Sie den Node SendEMail@1 in einer Transformations-Pipeline verwenden könnten. In diesem Beispiel ruft der Node ein Benachrichtigungstemplate namens emaildemo ab und speichert den Template-Text im Payload unter $.body und den Betreff unter $.subject. Im Template-Text gibt es 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