Formatting a string field

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Formatting a string field

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Formatting a string field

Post 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.
Attachments
99.TryParseInExpression.mrt
(3.81 KiB) Downloaded 275 times
Post Reply