This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I have some figures that I'm trying to create into dollar amounts with thousands separators. I am using the formula '$' + ToString([field],0,1) and I'm getting the $ but no commas.
Second issue is that before turning them into strings, I added all the values as Int64 to create one total which was accurate but when I run the workflow after using ToString on the other fields, the total field becomes a long string of each value instead of giving me the correct total whetherI use the ToString formula on the total field or not.
If your end result is an output going to Excel, you may be better off just adding a Table tool while the data is still in numeric format, get rid of the formula appending the dollar sign and it will maintain the value as a number and add a comma when output to Excel. When you add the Table tool, simply add the $ as a prefix to the data and Render out to Excel.
@jkm1683 - you are concatenating the data instead of adding it. This is because the fields are strings and cannot be added...they are concatenated instead. if you want to calculate a total, i would recommend doing it before the fields are turned into Strings.
I really think that you should look at considering the Table tool for what you are trying to do though. The Table tool allows you to take numbers and output them with commas and $ signs, or even % signs if it is a percent field.
Since your fields are strings, the formula tool is actually doing exactly what you are asking it, which is to append each column together. To do anything mathematical, the field type needs to be an Integer, Double, Float, or Fixed Decimal. The Table tool trick above is a quick way to keep your data as is while adding in prefixes & commas, also giving the ability to add some column/row formatting.