This is an excellent question!
Error when formatting scientific numbers
Usually one would use the formatNumber function to display numbers as a string (text)
But when the number is a scientific notation, this throws an error
Failed to map ‘value’: Function ‘formatNumber’ finished with error! ‘1.0442665000000301e+21’ is not a valid number or using unsuitable separator.
Why there is such an error
These sort of numbers being displayed as scientific notation usually means the number is too large to be stored as-is in the programming language. For example, in JavaScript (which Make uses), the max safe integer is 9007199254740991
(about 16 digits long). Similar auto-conversions happen in Excel when the number is too large.
Possible way to display the full number (as a string)
To solve this, you need to convert into a string, split up the scientfic notation into the float and exponent parts, solve the value separately, and display them as a combined set.
Step 1
I used the set multiple variables module to convert into string, and store the different parts of the number separately
Variable padding_required
is basically exponent - decimal_places
Variable padding
just contains a large number of zeros, to be trimmed to the number of padding zeros after the number.
Output:
Step 2
I remove the period from the first part, and trim the padding
to the required length. For demonstration purposes, I show you how to set each part separately. You can do both at the same time and combine into a single output variable (e.g.: number_as_string)
Output:
Step 2b
Here’s how the setup looks like if you want to combine both variables in a later step
Single Module?
It is possible to combine these two steps into a single module, but some “tricks” are required to do so plus it makes it difficult to maintain. If you really need this I am available for a consult.