Page 1 of 1

number formating

Posted: Wed Mar 07, 2007 3:09 pm
by lubosh
Hi,

I have a decimal input, I need to format this number on the report in a way, that value 25.5 will display as 25.50, -25.5 will display as (25.50) and zero will display as "-" (simple dash).

usually I would format this number with format string "f2;(f2);-" but that doesn't seem to work in your control.

Any suggestions?

number formating

Posted: Thu Mar 08, 2007 4:11 am
by Edward
Please use the following expression in the Text property of the StiText component:

In the case of the DataColumn with the decimal type:

Code: Select all

{MyDataSource.MyDataColumn.ToString(“#0.00;(#0.00);-“)}
In the case of the column with the string type:

Code: Select all

{decimal.Parse(MyDataSource.MyDataColumn).ToString(“#0.00;(#0.00);-“)}
Thank you.

number formating

Posted: Thu Mar 08, 2007 8:44 am
by lubosh
thanks a lot. that makes perfect sense, I had no idea I can use .NET methods on my variables in your designer. anyway, that makes whole thing a lot more flexible.

problem solved, thanks again

number formating

Posted: Thu Mar 08, 2007 9:14 am
by Vital
Please contact us if you need any help.

Thank you.