Hi,
I am trying to concatenate 5 fields of string data into one in a new column. I am using the formula: [Business Unit (K)]+[Currency (K)]+[Security Group Cd (K)]+[Resident Code (K)]+[Data] . However, I am receiving the error: "The formula resulted in string but the field is numeric." I would like my data to be output as String data. Is there a way to change this/something wrong with my formula?
Thanks!!
Solved! Go to Solution.
Hi @grsomer
Two questions:
1) Are all of your fields strings? If not, you need to use ToString function to convert them into strings in your formula
2) Is your new column set as a String type? You can check that below your expression box in the Formula Tool, there's a "Data type" section.
Cheers,
You are getting the error because of your fields is not a String and the Formula Tool doesn’t automatically convert field types.
You can place a ToString() function around the non-string field.
You can see the field types on the Result Window on the Input Connection for the Formula, after clicking on the button labeled “MetaData”
Hi @Thableaus, thanks for the quick reply!
All of my data is already string and the box to change the data type in the formula tool is greyed out and won't let me change the data from Double.
Hi @darryl5280 , all of my data being used in the formula is already string, and the ToString formula has not worked for me.
The problem is with your new column. Actually you're updating an existing column that is a Double Type already.
To change types you could use a Multi-Field formula. You can actually change the type of your existing column right there.
Or, you could use a Select Tool and change your column to String before using it in the Formula Tool.
Cheers,
You have to Create a new field, and then in "Select" after the Formula Tool, to swap the new field name with the old field name.