I have a query that I want to run using N/task and...
# suiteql
w
I have a query that I want to run using N/task and export to a CSV because of the size and time it takes to run it. I have some amount-fields that are divided by 1000 but I still need to keep the decimals. I notice that the CSV file will get rounded to two decimal places and formatted in the format in my user profile. I've tried using BUILTIN_RESULT.TYPE_FLOAT, but it still rounds it. running to_char() on the column works but outputs it as a text enclosed in quotes. Anyone has any other tricks up their sleeves?
j
Just a guess, but ROUND(field, X)?
w
This is one of the formulas:
Copy code
ROUND(SUM(DECODE(AT.left,'T', 1, -1) * SIGN(TAL.amount) * ABS(NVL(plan_rev.amount, TAL.amount)) ),2)/1000) AS amount
So I round the sum() to 2 decimal places and then I want to divide it by 1000 to get it in thousands.
d
could you just throw it into a
TO_CHAR
? something like:
w
Yes, I can, but the values are then enclosed with qoutes. I have my doubts that the target system for the file will accept that.
At the moment, the file is ~2MB, so I can still add a dependant script that loads the file and reformats it to a csv in my desired target format.
d
Sorry Watz, I don't know how on earth I missed the fact your already mentioned TO_CHAR in your post 🤦