Dynamic text in dialog

I have a dialog and I need to add some text at the beginning. it goes something like “Enter only <tablename.colname> characters”

So the text should display the value in that column of the table

dialog.addtext(“Enter only characters”)

I tried using a + operator, but it gives a syntax error “Operands types are not compatible with the operator” which makes sense as the column in question has integer values. Any suggestions?

Hi,

try with the strfmt() function instead of passing directly the string.

dialog.addtext(strfmt("Enter only %1 characters",<value in that column>));

An alternative solution would be converting the integer to string (int2str()), nevertheless strFmt() is indeed the best way for such formatting.

It works now. Thanks