Pre-defined search returns all rows if one of the criteria is never met

Pre-defined search returns all rows if one of the criteria is never met

LimpEmuLimpEmu Posts: 65Questions: 18Answers: 1

Link to test case: Not available
Debugger code (debug.datatables.net): akeduz
Error messages shown: No error messages
Description of problem: I am using a pre-defined search to allow users to quickly find incomplete records. The problem is that sometimes the category used for one of the components of the search is not met which then results in the entire search to not work (all records are shown). Is it possible to run a pre-processing step prior to running the search to ensure that the category required is present?

My only other option is to create some auxiliary field that is e.g., "N" when the condition is not met and use that auxiliary field with a not equal, but I would prefer to avoid that.

Thank you.

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    What kind of search are we talking about here? Is it a custom one, one with SearchPanes, or something else. Can you link to a test case showing the issue so I can form a better picture of what is going on please?

    Allan

  • LimpEmuLimpEmu Posts: 65Questions: 18Answers: 1

    I am using searchBuilder, the predefined search is a JSON object.

    I ended up using an auxiliary field.

    Another solution would have been to use a different operator. When using equal, and the category does not occur in the data, the query does not work (I guess because search builder checks the categories that occur in the data; if a category in a pre-defined search does not exist in the data, the query settings cannot be fully loaded). But if I use the operator "starts with" or "contains", the query can be loaded correctly and works.

    Thank you for looking into this.

Sign In or Register to comment.