Lorenzo
12/02/2024, 10:33 AM{
"q": "SELECT tl.item AS item_id, SUM(tl.amount) AS total, COUNT(*) as count FROM transaction t INNER JOIN transactionline tl ON t.id = tl.transaction WHERE t.type = 'SalesOrd' AND t.entity = ? AND t.trandate BETWEEN TO_DATE(?, 'YYYY-MM-DD') AND TO_DATE(?, 'YYYY-MM-DD') GROUP BY tl.item ORDER BY tl.item",
"params": [
"Andala",
"2024-10-01",
"2024-11-01"
]
}
The query works if I hardcode values into the string, but not if I use placeholders and a "params" arrayCeligo AI
12/02/2024, 10:33 AMAI generated answer (using internal Slack threads):Based on the conversations, it seems that the REST web services do not support prepared statements. Therefore, you cannot use placeholders in your SuiteQL query when using REST API. Instead, you will have to construct your query string yourself. Here is an example of how you can do it:
python
url = "https://{url_account}.<http://suitetalk.api.netsuite.com/services/rest/query/v1/suiteql|suitetalk.api.netsuite.com/services/rest/query/v1/suiteql>"
headers = {
"Prefer": "transient",
"Content-Type": "application/json"
}
query = f"SELECT * FROM Transaction WHERE createddate > {your_date}"
body = json.dumps({"q": query})
response = <http://client.post|client.post>(url=url, data=body, headers=headers)
In this example, your_date
is the value you want to use in your query. You can replace it with the actual value you want to use.
Remember to replace {url_account}
with your actual account URL.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
12/02/2024, 10:33 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.895750463
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826237261
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824096143
Celigo AI
12/02/2024, 10:33 AM