Page 1 of 1

Problem with Decimal values

Posted: Mon Sep 26, 2011 1:33 am
by Naveen Aggarwal
Dear Sir

I am using a firebird table which has lot of decimal type columns. In firebird the data is displayed properly i.e. 4.00 is displayed as 4.00 but in stimulsoft, 4.00 is displayed as 4. That created some unexpected problem for me . Actually i have a column height decimal(6,2) which stores heights of students in a school. The height is entered as 4.11 for some one having height of 4 feet and 11 inches. I tried to display it as 4'11" by first converting the decimal to string and replacing . with ' and appending the resulting string with a ". It went well for all the values except 4 and 5 which were printed as 4" and 5". That happened because stimulsoft treated 4.00 as 4 and 5.00 as 5. Is there any workaround ? I am not aware if it happens with other databases like sql server and mysql also.

Thanks in advance !!

Naveen Aggarwal

Problem with Decimal values

Posted: Mon Sep 26, 2011 2:37 am
by Ivan
Hello,

Please try to use the following expression:

Code: Select all

{(4.00).ToString("n2").Replace(",", ".").Replace(".", "'") + '"'}
Thank you.

Problem with Decimal values

Posted: Mon Sep 26, 2011 3:50 am
by Naveen Aggarwal
Thanks a lot for your reply sir !

As i mentioned, the data is coming from decimal column in a table. Will it work in the same way if i replace (4.00) with the column name. Main problem is that Stimulsoft treats 4.00 as 4.

Regards !

Problem with Decimal values

Posted: Mon Sep 26, 2011 10:01 am
by Naveen Aggarwal
Dear Sir

I tried the expression suggested by you ! It has resulted in one more problem, the value 4.5 is now printed as 4'50" which is not the way i want. It will give an idea that height is 4 feet and 50 inches which is not correct. Any other workaround if possible ?
Thanks in advance !!

Problem with Decimal values

Posted: Tue Sep 27, 2011 2:06 am
by HighAley
Hello.

You can do it using your function. Please, look at code in attached report.

Thank you.

Problem with Decimal values

Posted: Tue Sep 27, 2011 5:05 am
by Naveen Aggarwal
Thanks a lot for your reply sir !!

I did have a look at the report sent by you but was not able to find the definition of the function ToInches.
How can i write my own function and pass to the report !!

Thanks a lot in advance !!

Problem with Decimal values

Posted: Wed Sep 28, 2011 3:10 am
by HighAley
Hello.
naveenagg wrote:I did have a look at the report sent by you but was not able to find the definition of the function ToInches.
How can i write my own function and pass to the report !!
You can find it in the Code tab. Your function must be before this string:

Code: Select all

#region StiReport Designer generated code - do not modify
Thank you.