Answer from custom script calculation


i have a custom script built with an output number.  Cant seem to figure out how to include a thousands separator for the answer.  I am piping in the answer to a text page.  Got the decimal points to work but I have seemingly tried everything on the forums to figure out the comma separator and am stumped!


Example code from script:

%%peracre = sgapiGetValue(51);

%%acres = sgapiGetValue(65);

%%overalldollarslost = (%%acres * %%peracre); 



Output calculates great but I want answer to be 123,456


Right now it is 123456

Brad50 answered

    I think that the sgapiNumberFormat function should do this for you.  See the documentation for details –

    Be aware that if you export your results as a CSV file, the comma in the data may be interpreted as a separator. 

    Brad50 commented
      • Thanks Jim. I have seen this and a few more items that should be working. I cannot figure out where to put the code. I have had good success with changing merge codes for other formatting such as decimal points etc. but this one has me stumped.

        Does this code go in the existing custom script page or on a separate page? Not seeming to work for me.

      • never mind got it thanks!



      Question stats

      • Active
      • Views5103 times
      • Answers1 answer
      • Followers1 follower