ian11
February 28, 2025, 3:55pm
1
This is related to the “Do a search for” option when getting things from the database - not the search input.
Here is the scenario.
I have three datatypes for inventory values
In stock
Inbound
Reserved
Each is a number.
I want to give my user the ability to return any product where any of those fields is greater than zero.
ex:
Do a search for: Products
In stock > 0
OR
Inbound > 0
OR
Reserved > 0
Any idea if this is possible and how to pull it off?
As I am typing this, I am thinking the best way would be the “merged with” option and search each field separately.
ian11
February 28, 2025, 3:57pm
2
The problem with “Merged with” as I see it is that I then have something like 6 conditionals…
"If “In stock” is checked then data source = “Do a search for” "
x6 which is exhausting.
Here is the solution I am working on in the moment, let me know if anyone has a better idea.
When someone ticks the box for “in stock” “inbound” etc.
It does a search for the products that match that criteria and saves it as a list to a database item called “Report”
Then when they finalize the search it says “inventory inbound merged with inventory instock merged with inventory reserved”
OR is not possible directly. You could however make a composite field in your case and search on that.
e.g. A new field which is sum of the three values and you update it when either of them get updated. Then you can search for new field > 0
Of course this is specific to the problem you posted. But you can use the same thought process if use-case is bit different as well.
1 Like
i dont know if this helps but
in boolean logic A or B is the same as not (not a AND not b)
so A >0 or B > 0 or C > 0 is the same as
not (A <= 0 AND B <=0 AND C<=0)
So you could do a search for the whole thing and then :minus list do a search for (A<=0 AND B<=0 AND C<=0)
2 Likes
ian11
February 28, 2025, 8:08pm
5
This is close to what I have settled on…
There is a field for “inventories”
And for each selection in the filters it searches for the correct entries and uses “Add list”
So it’s like your idea in reverse.
I’d use a custom event for this
custom event accepts each of the searches as a parameter
then the custom event has 1 step to merge the searches together and return them as a parameter
this way if you have to change one of the custom searches you don’t have to rewrite all of them since they are all held separately in the custom event
and yes you’d need to do separate searches for all the match groups and then merge together
with add list you may also need to add unique elements to ensure no duplicate entries. Not sure if it is still an issue but it would add duplicates in the past when add list was used.
You can use :merged with on two searches. :merged with is a closeted OR operator.
1 Like