CR 8.5 and SQL Server 2000.
I have two fields:
FormatType and Result. The FormateType has the format information of the Result field. Like if FormatType is 0.00, the Result should be 0.00, if FormatType is 0.0000, the Result should be 0.0000. I have created this function:
dim decpos as number
dim rdec as string
dim FormatType as string
' say FormatType ="1.2345"
' say the Result value is 52.7450
If Len(FormatType )<=1 Then /because no need to change format
formula={table.Result}
end if
if "." in FormatType then
decpos=instr(Trim(FormatType ),".")
rdec=right(FormatType ,Len(FormatType )-decpos)
formula=totext(toNumber(Result),"###."&ReplicateString("0",Len(rdec)))
end if
I am getting Result=52.7400, I want to be able to see it as 52.7450. How should I tweak this formula to get correct formated result?
Or any better way of doing this ?
Thanks
I have two fields:
FormatType and Result. The FormateType has the format information of the Result field. Like if FormatType is 0.00, the Result should be 0.00, if FormatType is 0.0000, the Result should be 0.0000. I have created this function:
dim decpos as number
dim rdec as string
dim FormatType as string
' say FormatType ="1.2345"
' say the Result value is 52.7450
If Len(FormatType )<=1 Then /because no need to change format
formula={table.Result}
end if
if "." in FormatType then
decpos=instr(Trim(FormatType ),".")
rdec=right(FormatType ,Len(FormatType )-decpos)
formula=totext(toNumber(Result),"###."&ReplicateString("0",Len(rdec)))
end if
I am getting Result=52.7400, I want to be able to see it as 52.7450. How should I tweak this formula to get correct formated result?
Or any better way of doing this ?
Thanks