Converting an integer to a string

Hi,

I need to concatenate a string where one piece of the data is an integer.

I have a numeric text field (RecipeInUse) bound to a recipe number in a table. I then defined a dynamic property (RecipeField) with the expression “Alt”+{Root Container.RecipeInUse.text}+“Qty”. I need to use this string as a field name for a query.

The problem is that RecipeInUse is an integer and the expression returns “Alt1Qty”. What I need is “Alt1Qty”.

I tried using str(RecipeInUse) but this function is not available.

Am I on the right track or have I already derailed?

I think you’re binding to the wrong value in your expression. You should point it to the int RecipeInUse, not the numeric text field’s text value. Try using the binding (chain link) icon to browse to the int property.

You revealed a problem in my description. I am using the numeric label (a double) not the numeric text field. I changed from the .text to the .value property and the new string was Alt1.0Qty. I Then Used the toInt function to yield:
“Alt”+toInt({Root Container.RecipeInUse.value})+“Qty”. Now I have the right string being created.

My new question is: If I am concatenating a string shouldn’t I be able to use the text property instead of using the value property (a double) and then convert it to an integer?

No, because the text of a numeric label is more than just the value - it includes a prefix, suffix, and units. See the manual page here inductiveautomation.com/prod … _Label.htm and it should become clear.