on 08-11-2015 12:09 PM
Hi all,
I am using crystal report 9.0 version.
In the data base field "ResultVal" is in nvarchar datatype. Data value of ResultVal column some of having numerical results and some of the Alpha numeric data and some of having only alpha data.
Now, I wanted to display the "Resultval" field in crystal report and If "ResultVal" field contains only numeric(with decimal), then decimal separator should be printed as per system decimal separator.
Example Data:
ResultVal | Output in report, if decimal separator is "," | Output in report, if decimal separator is "." | |
12.15 | 12,15 | 12.15 | |
12.96 | 12,96 | 12.96 | |
15.77 | 15,77 | 15.77 | |
AK78 | AK78 | AK78 | |
OR001 | OR001 | OR001 | |
RES | RES | RES | |
99.01 | 99,01 | 99.01 | |
14.03 | 14,03 | 14.03 | |
15,96 | 15,96 | 15.96 | |
10,00 | 10,00 | 10.00 |
How to update the decimal separator in system:
Control panel >> Region and language >> formats TAB >> Click Additional settings >> Decimal sysmbol >> Enter ","
Please help me how to resolve the problem.
Thanks in advance..
Sankar
Hi Sankar,
Try:
If isnumeric({string field}) then
Totext(Tonumber({string field}))
Else
{String field}
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You'll need to do more than that. Try this please:
stringvar x := {string_field};
if isnumeric(x) then
(
if instr(x,',') > 0 or instr(x,'.') > 0 then
(
numbervar intg := if instr(x,',') > 0 then tonumber(Left(x,instr(x,',')-1)) else if instr(x,'.') > 0 then tonumber(Left(x,instr(x,'.')-1));
numbervar dec := if instr(x,',') > 0 then tonumber(Mid(x,instr(x,',')+1)) else if instr(x,'.') > 0 then tonumber(Mid(x,instr(x,'.')+1));
totext(tonumber(totext(totext(intg,'#')&'.'&totext(dec,'#'))));
)
else
totext(tonumber(x));
)
else
x;
-Abhilash
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.