7 Replies Latest reply: May 15, 2014 10:14 AM by Gary Morris

# Combine a numeric field with a text field in a calculated field

Hi,

I have a calculated field that combines several text columns i.e. ABC+D = ABCD

I want to add a numberic field into the calculated field i.e. ABCD10 = ABCD10.

The calculated field has to be set to character of course but is what I have highlighted above impossible to do?

Any help on this most appreciated!

• ###### Combine a numeric field with a text field in a calculated field

Yes, you can accomplish this with this expression:

ABCDTrim(Str(NumericField))[/CODE]

• ###### Combine a numeric field with a text field in a calculated field

Thanks very much indeed. Worked a treat

• ###### Combine a numeric field with a text field in a calculated field

Just realised that the number added has rounded up to lose the decimals i.e. 6,543.96 has become 6,544 in the calculated field. Any idea how I can keep the 2 decimal places?

• ###### Combine a numeric field with a text field in a calculated field

Hello Gary,

Str() can take an argument for the number of decimals, it just defaults to zero.

Of the top of my head, it's str(NumField;x;"0";y) where x is the length of the output field, "0" is the fill character if you want leading zeroes, and y is the number of decimals.

Best wishes,

Olly

• ###### Combine a numeric field with a text field in a calculated field

Almost, Olly.

ABCDTrim(Str(NumericField;20;2;""))[/CODE]

An alternate, should you not want to include the decimal point for whatever reason:

ABCDStrip(Trim(Str(NumericField;20;2;""));".")

/CODE

• ###### Combine a numeric field with a text field in a calculated field

Hi KeyserSoze,

My apologies for not coming back sooner to say many thanks for your help. I tried the formula that you suggested and it almost worked a treat. The only thing that doesn't quite work is when the number ends with .00 in which case the .00 doesn't appear in my "combo". Anything other than .00 works fine. I have got round this for now by using Excel for the final bit of the "combo". I tried tinkering with the formula that you suggested but without any joy.

If you happen to know how to get round this issue then that would be great otherwise I am cool on this.

Cheers

Gary

• ###### Combine a numeric field with a text field in a calculated field

Hi Olly,

sorry, I should have come back to you sooner to thank you for your prompt response. I followed KeyserSoze's suggestion and it very nearly worked. the one issue is that if the figure I want to add ends in .00 then the formula chops this part of the combo. anyhting other than .00 works. I'll go back to KeyserSoze on this. I have used Excel for the time being to add the final part of the "combo" to what I put together in Monarch

Cheers

Gary