简体   繁体   中英

Crystal Report: hide some objects with Format Object - Suppress Formula

I have a report that outputs 4 labels per page.
The data are correctly retrieved from an ArrayList of a class that I have made only for the report and are correctly displayed.
In my class there are also 4 booleans named: Show1, Show2, Show3, Show4, that I'm using for adjust the visibility of 4 Text Objects with a White background, 1 for each label:

if isnull({MyModel.Show1}) then
  false
else
  if {MyModel.Show1} then 
    true 
  else 
    false

The problem is that the report throws an exception, asking me for a Boolean. But these variables are never null, always false and true when necessary. I have put the null-check for avoid problems, but the exception is thrown without the null check too. I have tried to change the type of the variables, using an int instead of a bool and checking the number, returning true or false if 1 or 0: nothing changes, in this case the exception asks me for an integer.

The exception is ErrorKind with the message A boolean is required here or A number is required here in the 2nd case.

I can't understand what is happening...

Any suggestion?

Thanks all

Ok, I've solved the problem.

I have realized that the formula wants the condition, not the return value. So the correct formula, in Crystal syntax, is:

{MyModel.Show1} = true

If the condition is true, the return will be true, else the return will be false, and all work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM