E9.2 Currency in groovy

Stank1964

Well Known Member
Hi Guys.

So, when I am working with a currency value, like unit price with groovy, what's the correct groovy data type that I should be using? I have tried number, float, double, BigDecimal, all of those seem to not preserve the correct currency value or they flat out truncate the currency value for insignificant digits, like "70.00" can become 70 or 70.0 or 70.xxxxxxxxxxxxxxxxxxxxxxx99999, where all those "x"'s and "9" are other values - the point is that none of these data types will take 70.00 and yeild a value of 70.00.

Any ideas? Thanks!
 
Can you cleanse a script with input that displays what you are talking about? I've worked with numbers plenty but I'm not sure I've seen what you're mentioning here

I've said it here before and I'll say it again, chatGPT4 is a wizard with figuring out intricacies of groovy that otherwise would have taken me hours of googling and trial and error. I've spent less than 1 hour since starting using chatgpt to fix scripting issues and write new features.
 
Last edited:
What happened here was that the calling app was including the numeric value in exponential notation if the number was evenly divisible by 10. Believe it or not. So, to get around it, we made the number a string and starting passing the data that way. It fixed it. I figure this out using a great technique. The first operation in the orchestration was to email me the request. Using email to get the request (and the API response) is a very handy way to figure out what the heck is happening to/for you.....
 
thanks for the follow up!! using strings for everything, converting them to number/date to do other things, then converting back to string seems to be the answer for everything orchestrator.
 
thanks for the follow up!! using strings for everything, converting them to number/date to do other things, then converting back to string seems to be the answer for everything orchestrator.
Really, I have not found that to be an issue in ORCH itself, the reason we needed to go that route for this issue, was clearly an issue with the request .
 
Back
Top