Answer the question
In order to leave comments, you need to log in
How to store combinations of logical operators in a table?
Greetings.
Are there any patterns/best practices for efficient storage of rules consisting of combinations of logical operators?
The task is to dynamically build filters to select records in the table that match the rule. And also be able to edit the rules.
It is preferable to store the rules in a table.
Rule example:
Rule1: (feature1 = 3 AND feature2 > 5) OR feature3 like '*.google.com'
Picture with an example of setting up a rule in the interface:
I tried to find ideas in Google, but I didn’t get further than truth tables and Karnaugh maps.
Thanks in advance also for the correct wording for Google.
Answer the question
In order to leave comments, you need to log in
Surprisingly, but the easiest way to store such things is in SQL, KQL (Kusto Query Language), or analogs:
- scarify with a string - parse
when received (with ready-made libraries) and draw an interface
- save as Query when saving
- PROFIT!
Store the database queries themselves as strings.
Why reinvent the wheel?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question