How to program a set of conditions when the event occurred?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
For example, I need that when certain conditions arose the event. For example, "if A > 2000 and B = 1, then [the event occurred]" or something.
The point is that the user should be able to generate such a condition, dynamically selecting the parameters (if, and, or, greater, less, how many times, what time, etc.). It is also easing the task of the programmer, which is not necessary every time hardcoding the conditions in the algorithm. Could not find the description of a similar algorithm in the Internet, but remember that it was in any cms. While I think about the form that post to a sign with the required columns of the row, of which going this condition in the future. But this is not true exit, I think.
by | 43 views

3 Answers

0 like 0 dislike
>but I remember that it was in any kind of cms
I think it was Beatrix...
0 like 0 dislike
Will help because of my understanding of your question. If misunderstood, I apologize.
The user creates the desired condition.
The condition is placed in the array.
It is also possible to provide that should be performed on this condition.
To have, for example, the object "Condition":
condition: 'text terms',
list of events: [function1, function2];
And this object is put in the condition array.
("list of events" can also be specified by the user)
When there is some action, we check the array check whether vypolnite conditions.
If true, then check the functions inside the object "Condition" and execute them.
There is also a design pattern the Observer
0 like 0 dislike
Once (but that was long ago and not true) decided a similar subproblem as follows: in the GUI formed a query (tree or leaves "parameter, operation, value[, value2[, value3[ ...]]]]", or subtrees with the root "AND"/"OR", after clicking "Save" or "Run", he remained as a tree for later editing and further recursively transformed into a SQL expression (sub-task was to make a report designer for a fairly extensive database of profiles, hidden from the SQL user and generally tabular nature of the database). If you have an expression in SQL in the end are converted, and the language interpretively, you can use a similar principle to the tree view interface if you want to store for later editing/output, save a tree, and most importantly generate on your YAP expression and then run it through the function, many languages call to eval().
110,608 questions
257,186 answers
27,842 users