Idea

Enrique Elizaga avatar image
2 Likes"
Enrique Elizaga suggested Jon Abbott edited

currency format. Be able to show coin value with a $ and .00

Sometimes we simulate cost. Great to have the possibility to select if the table value is currency.

Then instead of showing: 40000000

It would show: $ 40,000,000.00

With or without cents would be ok. But great for viewing values and showing it to the audience.

usabilitycoin formatcurrency fonumber format
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Comment

·
Jon Abbott avatar image
1 Like"
Jon Abbott commented Jon Abbott edited

Hi @Enrique Elizaga, in case you still need this functionality, here is a workaround solution:

1. Make a new user command
2. Enter in the following settings:

  • Name: financify
  • Parameters: (Variant n)
  • Return type: string
  • Example: financify(1234.56)

3. In the code editor for this user command, copy and paste the following code:

/**Custom Code*/
Variant n = param(1);
Variant dec_fraction = Math.fmod(n,1);

if (n < 1000)
{
    return (n);
}
int ndiv = n/1000;
Variant nmod = n%1000;
string nmod_string = string.fromNum(nmod);
string dec_fraction_string = string.fromNum(dec_fraction,2);

return (financify(ndiv)+","+nmod_string.padStart(3,"0")+"."+dec_fraction_string.substr(3,2));

4. Then call financify(number) from anywhere in FlexSim and it will return a string version of the number with commas as the thousand separator. A currency symbol can be added before it with "$"+financify(number). The code can be changed to use different thousands separators as well. Good luck with it! Hopefully FlexSim will add a currency unit selector in the Model Settings as well as support for format specifiers in a future release.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write a Comment

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.