Click to See Complete Forum and Search --> : Change Value Formula Field


huessso
June 10th, 2009, 07:53 PM
I'm have a Formula Field in a .rpt, the formula field is called varTotal
Ok
I'm using Basic Syntax in the report and I have this code


if not isnull({ESCALA_DCTO.PORC_DCTO}) then
{@varTotal} = 1
end if

When I try to set a value to my formula field ( {@varTotal} = 1 )
I get an error "A statement is expected here"

How can I set a value to that formula field...?

Thanks

jade1977
June 11th, 2009, 05:02 AM
I could be wrong, but I do not believe that you can set the value of the formula like that. I think what you want is to create a variable in the formula and set that value to 1.

BrianL
June 11th, 2009, 03:36 PM
Hi Huessso,

To use variables in Crystal syntax, you declare the variable type, i.e.

StringVar VarTotal;

or

NumberVar VarTotal;

After declaring the variable, you can set a value to it by using the := sign. So for your example you'd want something like:

NumberVar VarTotal;
if not isnull({ESCALA_DCTO.PORC_DCTO}) then
VarTotal := 1

The statement "VarTotal = 1" is a Boolean, returning true or false depending on the current value of VarTotal.
The statement "VarTotal := 1" sets the value of the previously declared NumberVar "VarTotal" to 1.

Hope this helps,
Brian