Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Boolean Formula 1

Status
Not open for further replies.

pgmr

Programmer
Joined
Dec 30, 2001
Messages
51
Location
US
Hi,
Using CR8.5, reporting off SQL 7.0. I have a field ISActive which is boolean (-1 or 0). I want to create a parameter in which the user will be able to select Active, Not Active or Both and then select records based on their selection.
Thanks in advance!!!
 
I am guessing here; but could you not set it up as a parameter? in the default values window you can have the (-1) (0) and (-1 and 0) as the actual options, then set up the description for each as ACTIVE / NOTACTIVE / BOTH respectively... then you can choose which way the users see it in parameter box itself. (either by value, description or both)...

then inside the record selection add:
{ISActive} = {?parameter title}

I hope this is able to help you...
Shannon
 
Thank you for your response.
The problem is the record selection formula.
It will not evaluate the expression (-1 and 0) since it is a boolean. I guess what I need is a formula like if Active select active records, if not active select NotActive records and don't perform the record selection (ie: select all records) if Both. I don't even know if this is possible.

Thanks,
Colleen
 
what about this:

{ISActive} = 0 or {ISActive} < 0

would that work?
 
Try:

If {?parm} = &quot;Active&quot; then
{table.Booleanfield} = true
else
{table.Booleanfield} = false

Crystal will convert this in the SQL to {table.Booleanfield} = 1 or 0

-k kai@informeddatadecisions.com
 
Synapsevampire:
I get the message &quot;A number is required here&quot;. In the database the result is -1 or 0.
 
Hmmm, current versions of CR treat booleans as true/false.

Try:

If {?parm} = &quot;Active&quot; then
{table.Booleanfield} = -1
else
{table.Booleanfield} = 0

and see if that works.

-k kai@informeddatadecisions.com
 
Thanks for the suggestion, It works well when I select Active or select Not Active, but when I select Both, I only get NotActive records

Thanks again
 
Try this:

if {?parm}= &quot;Both&quot; then {table.Booleanfield} in [0,-1] else
If {?parm} = &quot;Active&quot; then
{table.Booleanfield} = -1
else
{table.Booleanfield} = 0
Mike
If you're not part of the solution, you're part of the precipitate.
 
Yes, Thank you it works great!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top