Skip to main content
Question

Issue with Sending a Multi-line SQL Query via Databricks API Request Body

  • September 22, 2025
  • 2 replies
  • 14 views

hundleymf
Forum|alt.badge.img+4

My team is working on a Databricks SQL statement and wanted to see if anyone may have any insights. It looks like our bot isn't showing the responses when we test. The logs show that the actions are running without errors, but the conversation logs show that the output is coming through as null. Since the mapping is Moveworks-specific and a bit complex, I’ve attached the logs so others can take a closer look and help troubleshoot. Statement is something like this, I’ve redacted proprietary information:

{
  "statement": "SELECT DISTINCT <InvoiceID>, <SupplierName>, CONCAT(<BusinessUnit_PO>, ' ', <PurchaseOrder>) AS PO_ID, <VoucherStatus>, CASE WHEN <VoucherStatus> = 'STATUS1' THEN <PaymentDate> ELSE NULL END AS PaymentDate, CASE WHEN <VoucherStatus> = 'STATUS1' THEN <PaymentID> ELSE NULL END AS PaymentID, CASE WHEN <VoucherStatus> = 'STATUS2' THEN <ScheduledPayDate> ELSE NULL END AS ScheduledPayDate, CASE WHEN <VoucherStatus> IN ('STATUS3', 'STATUS4', 'STATUS5', 'STATUS6') THEN <RuleDescription> ELSE NULL END AS RuleDescription, CASE WHEN <VoucherStatus> IN ('STATUS3', 'STATUS4', 'STATUS5', 'STATUS6') THEN <RuleCauses> ELSE NULL END AS RuleCauses, CASE WHEN <VoucherStatus> IN ('STATUS3', 'STATUS4', 'STATUS5', 'STATUS6') THEN <RuleCorrectiveAction> ELSE NULL END AS RuleCorrectiveAction FROM <TableName> WHERE REPLACE(<InvoiceID>, '-', '') = REPLACE('<InvoiceNumber>', '-', '') AND RIGHT(REPLACE(<PurchaseOrder>, '-', ''), 4) = '<PO_Number>'"
}

 

 

 

2 replies

Kevin Mok
Forum|alt.badge.img+1
  • Community Manager
  • September 23, 2025

Hi ​@hundleymf - I see an issue in the output mapping

result.data_array[0][item.position]

This is an incorrect way of accessing a value in an object since you cannot dotwalk inside an accessor “[item.position]”. I am not sure what the schema of the API response is, but that most likely needs to be changed to something such as:

result.data_array[0].item.position

 


hundleymf
Forum|alt.badge.img+4
  • Author
  • Inspiring
  • September 23, 2025

Thank you ​@Kevin Mok. We were also told to try a script action. We’ll be doing some testing today to see if this helps. Appreciate your response!