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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does this work? (User prompted filter)

Status
Not open for further replies.

Corgano

Technical User
Oct 7, 2003
82
US
Hello,

I've been reading through all the great stuff here and found a solution to a question I had regarding filtering off of a user-prompt. I had to play with the inital format but eventually found a solution that worked.

The logic seems a bit off to me but the possibilities opened by this solution could really be huge for the report set we're working on, so understanding exactly WHY it functions is as important it working.

Here's the sample:


[rest of filter] and (1=if(Outage Filter and ?prompt?='YES') then (1) else if (?prompt?='NO') then (1) else (0))


Now, &quot;outage filter&quot; is a custom filter already built into the table to filter out incomplete records. So you dont need to add &quot;and timein <> 0&quot;, it checks four different items to make sure they all exist.

If the user enters 'YES' the filter is applied, if the user enters 'NO' is isn't. This was veryified by removing the prompt and testing the data with and without the filter directly applied.

So! What's going on? I see the filter is being &quot;tagged&quot; onto a 'YES' response but as both 'YES' and 'NO' both result in a true 1=1 I'm not sure how far this same method could be taken.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top