hiding records from multi-search
I have a checkbox field in my section (do_not_display) and I want to exclude any record that is checked from the search results. I already found (unsuccessfully) you cannot use a where clause and I found another archived entry which frankly I just didn't understand (perhaps I need more coffee today).
Below is the search code for that table, I can attach the page code if you think that would help but I can't figure out how to exclude these records marked as do_not_display.
$searchTables['x_leadership_sales'] = array(
'viewerUrl' => 'about-leadership.php',
'titleField' => 'title',
'summaryField' => 'content',
'searchFields' => array('title','content'),
Hi Deborah -
Thank you, it works functionally but there is one caveat, the numeric result lists then don't function correctly. Say for example I type in a name that I know is in do not display, it tells me there is 1 record in my result but of course because of the code, the record does not display (this is the good part).
I was hoping to exclude it farther up in the process so the results numbers are accurate.
Hmm. I hadn't considered that.
Maybe this post will help:
I've not tried this myself, but am interpreting that it might work for you to rename your 'do_not_display' field to 'ignoreHidden', which appears to be a special fieldname within CMSB.
If that doesn't work, post back and perhaps someone else can provide a working solution.
Hi Deborah -
I had the same thought this am - the section editor does indeed indicate that "hidden" is a special field type but the 'ignoreHidden' => true, statement still causes a 500 error on the page. I feel like we are close but there is some (critical) piece of information I am missing.
Well...now I feel dumb....
After reading some more entries in the forum about "hidden" records and how they behave I discovered the interactive tools (not surprisingly) guys already thought of this. if you use the "hidden" field as the checkbox in your section editor to hide fields you don't have to do anything in the search array to exclude these hidden records, it happens automatically.
By setting this:'ignoreHidden' => true, I was actually doing what I did not want to do which was to ignore that hidden field and show the record...some days...
If others have this issue, as long as you use the "hidden" field in your section editor then all will be well.