How to combine selection and search in a Text List Object?

I have a Text List Object with a search facility, so the Query panel contains this code:

(exportline() contains «_liveSearch») or («_liveSearch» = “”)

I also want to specify that the list contain only the visible records. How do I combine the info("visible") function with that code?

Simply use the and operator

(exportline() contains «_liveSearch» and info("visible")) or («_liveSearch» = "")

Not quite - your code doesn’t work , nor does this:

info("visible") and (exportline() contains «_liveSearch») or («_liveSearch» = "")

but this does:

(exportline() contains «_liveSearch») or («_liveSearch» = "") and info("visible")

Can you explain why?

Taking this a step further, is there a way to restrict the search results to visible records?

My database has a mixture of active and inactive records. Mostly, I want to show active records but the user has a button which selects inactive records and opens the Text List Object. However, if she uses the search facility in either of those situations, results are displayed from all records in the database.

AND, if I use this code:

(info("visible") and exportline() contains «_liveSearch») or («_liveSearch» = "")

all records are displayed but a search gives results selected only from the visible records. Very strange.

Correction - that last line of code should be:

 (exportline() contains «_liveSearch» or «_liveSearch» = "") and info("visible")

and the search results are drawn only from the visible records, as required.

My formula didn’t work because I didn’t think thru your specifications clearly. I believe my formula worked ok as long as you typed something into the search box – but you also wanted only selected records to appear if the search box was empty. My formula displayed all records in that situation, not just selected records. At least it would appear that I gave you the clue needed to solve the problem.

Indeed it did - thanks.