How do I break out of an array?

I am trying to format a number that is in the millions so that it is easily readable. My number comes to me as an array with just this one number example for ten million [10000000]

When I am unable to do things that I expect to work with functions I always find it best to put the object into a variable so that I can see what is going on.

here you can see the source JSON

here I am mapping it to my variable

and here you can see my output from mapping the variable

I then try to format the number
{{formatNumber(75.RoundSize; 0; β€œ.”; β€œ,”)}}

because this is an Array I get this error.

if I try:
{{formatNumber(75.RoundSize[1]; 0; β€œ.”; β€œ,”)}}

Then I can get it to work.

How can I write this directly without setting the variable?

If I try
{{formatNumber(map(72.entity.fields; β€œ[1]”; β€œid”; β€œfield-2943646”)[1]; 0; β€œ.”; β€œ,”)}}

It will look like this

and I get this error

Hello @aottarsson,

When you set RoundSize variable, the result of the map() function is an array.
When you try to run formatNumber on an array, you get that error.

When setting RoundSize, you can use the first() function on the array (the result of the map() function) to get the first element from the array. Then, formatNumber() should work.


Hi @aottarsson

The map function will provide an array as output. Therefore, you need to use the get function to pass the data as a number.

We have provided a sample format that you can adjust to your requirements.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel