Hello,
a!localVariables( local!number: todecimal(370737340900000.00), /* Replace this with your input number */ local!chunkSize: 7, /* Define chunk size (7 digits) */ local!divisor: 10 ^ local!chunkSize,
local!chunks: {}, /* List to store chunks */
local!x:a!forEach( items: enumerate(ceiling(log(local!number)/log(local!divisor)) + 1), /* Arbitrarily large number to iterate through */ expression:{ local!iteration:enumerate(ceiling(log(local!number)/log(local!divisor)) + 1), local!chunk: mod(local!number, local!divisor), /* Get last 7 digits */ local!number: round(local!number / local!divisor, 0) } ),
/* Reverse the chunks list to maintain the correct order */ reverse(local!chunks))
I want to achieve try to split the big decimal into 7 digit numbers, I want the result in the "local!x" {8765431, 7373409, 370}
I hope the question is clear, let me know how to achieve this.
Discussion posts and replies are publicly visible
a!localVariables( local!value: 370737340900000.00, local!chunkSize: 3, local!textValue: text(local!value, "0"), a!forEach( items: enumerate(ceiling(len(local!textValue) / local!chunkSize)), expression: mid(local!textValue, (fv!item * local!chunkSize) + 1, local!chunkSize) ) )
Thanks Stefan Helzle , Much easier