Joined: 23 Feb 2009
Location: India
Online Status: Offline
Posts: 6
Topic: Type conversion and extracting part of value Posted: 14 Jul 2010 at 4:28pm
Hi,
I want to extract a part of values from the decimal field. I want to
covert the decimal value i.e. "0.00010000" to string and extract the
value from left untill it is not whole number. for example, in
the above value I want to get out "0.0001" from left and the rest of 0s
on the right side on 1 should be omitted on the report. Similarly, if
the value in the database field is "0.02000000" then I just want to
extract the value "0.02" and rest of 0s should not be displayed on the
report. I got the below code which works fine but it does returns NO VALUE if the value in the database field is "1.00000000". I want it to return "1" if the value is 1.00000000.
if tonumber(datafield) = 1.00000000 then '1'
else
local stringvar text:=totext(datafield), 8,"");
local numbervar n:=3;
if int(tonumber({?datastr}))>0 then totext(int(tonumber({?datastr})),0) else ( local stringvar text:=totext(tonumber({?datastr}), 8,""); local numbervar n:=3; while text[n] = '0' do (n:=n+1); text:= left(text,n); )
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum