on 06-29-2015 10:35 PM
I've inherited a .xls file that i wish to process in Crystal.
But when a "number" filed type is blank, its actually returned as a string type with blanks.
this formula
round(tonumber({data.Capacity}),2)
fails with "the string is non numeric" when the filed contains the blanks
and this formula
if {'Capacity} = "" then tonumber(0.00)
else
round(tonumber({data.Capacity}),2)
fails with "expecting a number" when the field type is number
Is there anyway i can determine the field type before processing ?
i.e if "fieldtype= number"
then round(tonumber({data.Capacity}),2)
else if "fieldtype=string"
then round(tonumber({data.Capacity}),2)
Hi John,
With a .xls datasource it gets a little tricky.
The datatype of the fields is determined by the first row in each column.
You could try this code:
stringvar y := totext({data.capacity});
if isnumeric(y) then
round(tonumber(y),2)
else 0
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.