• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Require At Least One Filter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Require At Least One Filter

    An issue I frequently run into is that I have some generic SQL view that by default will process a huge pile of data and take many minutes to run. However, the intended end use is that some filter will be applied to that view and ultimately the intended results will come back in a second or less.

    As part of this filtering process, the user can select one or more fields to filter on to get their results. We set this kind of thing up using a form where the user can enter their filter values and then hit a search button. We use the Filter Widgets behavior and set all the filter options to Apply If Not Blank/0. This works great.

    The problem is that sometimes the user is sloppy or not paying attention and then hits the search button when there are no filter values filled out in the form. This cause the program to try and look up the entire data set which predictably bogs down the Valence job and slows things down. A malicious user can even hit that search button a bunch of times and basically DDOS our Valence system because all of the jobs allocated to handling processes get backed up.

    There are workarounds to handle this but I would like to request a feature where I can specify that one or more of a particular set of input fields in a form is required to be populated but any given field can be blank at any time. As long as any one of those fields is set, the user can do the search. If none of them are set, it should return them an error. We can do this sort of thing by manually adding RPG or Javascript preexecution checks but it would be handy to not have to do that every single time and instead have it built into Valence.

    If you want to get really useful with it, I would also like to have "required sets" which allows me to define some set of fields that may have to all be used at once. IE: if field B is used, you must also define fields C and D but field A may remain blank.
Working...
X