13,141,637 members (56,128 online)
Rate this:
See more:
Sir,
I got a error in crystal report formula.
This error is
The remaining text does not appear to be part of the formula.

This error get against the below code in formula editor in crystal report.
local Numbervar a:={DataTable1.DoubleField1}*1200/{DataTable2.DoubleField2}
local Numbervar intpart:=CDbl(truncate(a))
local Numbervar decpart:=CDbl(a-intpart)
if decpart>=0.0 And decpart<=0.24 then
{intpart}
else if decpart>0.24 And decpart<=0.74 then
{intpart+0.5}
else if decpart>0.74 And decpart<=0.99 then
{intpart+1}
else
{intpart}

Posted 22-May-13 0:03am
Updated 22-May-13 0:07am
v2

Rate this:

## Solution 1

try this
local Numbervar a:={DataTable1.DoubleField1}*1200/{DataTable2.DoubleField2};
local Numbervar intpart:=CDbl(truncate(a));
local Numbervar decpart:=CDbl(a-intpart);
if decpart>=0.0 And decpart<=0.24 then
(
intpart
)
else if decpart>0.24 And decpart<=0.74 then
(
intpart+0.5
)
else if decpart>0.74 And decpart<=0.99 then
(
intpart+1
)
else
(
intpart
);

Happy Coding!
:)
v2

Thanks for help.The error is still getting now.
Aarti Meswania 22-May-13 8:15am

see updated solution
and let me know it worked or not :)
Rate this:

## Solution 2

I have missed out the ";" sign on first three statement.
So the error was coming.

local Numbervar a:={DataTable2.FieldDouble2}*1200/{DataTable2.FieldDouble2};
local Numbervar intpart:=CDbl(truncate(a));
local Numbervar decpart:=CDbl(a-intpart);
if decpart>=0.0 And decpart<=0.24 then
(intpart;)
else if decpart>0.24 And decpart<=0.74 then
(intpart+0.5;)
else if decpart>0.74 And decpart<=0.99 then
(intpart+1;)
else
(intpart;)

Top Experts
Last 24hrsThis month
 OriginalGriff 215 Graeme_Grant 210 Jochen Arndt 185 ppolymorphe 113 Karthik Bangalore 110
 OriginalGriff 5,092 Graeme_Grant 5,018 ppolymorphe 1,814 Jochen Arndt 1,707 CPallini 1,500