Page 1 of 1

Formatting a string field

Posted: Wed Oct 15, 2008 2:29 am
by Fabio Pagano
I have a string field that can contains numeric values (eg. "6000" or "123,45") or text values (eg. "This is a text"). If the value is numeric i need to format it (eg. "6.000,00"). Does anybody can help? I cannot manage report events, all i can do is to write text or formulas in the field in the designer.

A subquestion: assuming that the string can contains only numeric values (eg. "6000" or "123,45") how can i format it (eg. "6.000,00")?

Thank you.

Formatting a string field

Posted: Wed Oct 15, 2008 4:02 am
by Edward
Hello, Fabio.
Fabio wrote:I have a string field that can contains numeric values (eg. "6000" or "123,45") or text values (eg. "This is a text"). If the value is numeric i need to format it (eg. "6.000,00"). Does anybody can help? I cannot manage report events, all i can do is to write text or formulas in the field in the designer.
Please declare an int type variable in the Dictionary.
Right-click on the text field and set its format as number with appropriate formatting parameters.
Write the following in the text property:

Code: Select all

{IIF(Integer.TryParse("6000", MyVariableFromDictionary),Me.Text1.TextFormat.Format(Integer.Parse("6000")),"not a number")}
A subquestion: assuming that the string can contains only numeric values (eg. "6000" or "123,45") how can i format it (eg. "6.000,00")?
The simplest way is right-click on the text and to select ''Format in context menu and set appropriate values there as in the attached report.

Thank you.