Reputation: 771
I am creating a Crystal Report using c# and I have to replicate a simple formula in 320 different parameters but always with the same condition as follows:
if ({Precios.AhorroE1}[1] = '-') then crGreen else ( crRed )
Each object has a different name (in the example aboce, Precios.AhorroE1 but I have to make the SAME condition for 320 different objects.
I've been trying to find a way to refer to the object that is evaluating the formula but I couldn't find it. I would like to know if it is possible to do something similar to:
if ({currentobject}[1] = '-') then crGreen else ( crRed )
Where currentobject
would be the object evaluating the formula.
Upvotes: 2
Views: 7858
Reputation: 7287
For formulas that evaluate to almost all data types you can use the keyword CurrentFieldValue
to format it. So if you had a formula that evaluated to a string, you could place it in the report and then set the color of its text the way you describe:
if CurrentFieldValue='-' then crRed else crGreen
Except formulas can never evaluate to an array so you can not use it in the way you're describing by indexing into the CurrentFieldValue
as if it were one.
Upvotes: 8