I have a sales order with one item This item has t...
# ask-stanley-ai
m
I have a sales order with one item This item has the quantity of 3 However, when I execute a SuiteQL command to check the quantity, I get 12 (or -12) Any idea why this is multiplied by 4? Here is my SuiteQL statement: Select * From transactionline Where transaction = 123 Can you give me the SuiteQL code that will give me the exact quantity (3 instead of 12), by using the conversion rate (which is 4)?
c
AI generated answer (using internal Slack threads):
It seems like you're experiencing an issue with the quantity being multiplied by the conversion rate. This is because the SuiteQL query is returning the quantity in base units, not transaction units. You can adjust your SuiteQL query to account for the conversion rate and get the correct quantity. Here is the adjusted SuiteQL statement:
Copy code
sql
SELECT 
    transactionline.*,
    transactionline.quantity / uom.conversionrate AS adjusted_quantity
FROM 
    transactionline
JOIN 
    unitstypeuom AS uom ON transactionline.unit = uom.internalid
WHERE 
    transactionline.transaction = 123
In this query, we're joining the
transactionline
table with the
unitstypeuom
table on the
unit
field. This allows us to access the
conversionrate
for each transaction line. We then divide the quantity by the conversion rate to get the correct quantity in transaction units. Please note that you might need to adjust the table and field names based on your actual database schema. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844267964
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825370491
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825145483
Please provide your feedback on this answer.