rule to check count of db query
Author: Maikman83
Publication Date: 8/12/2022 9:19
Hello everyone,
is it possible to define a rule that checks the count of a db query and when the query count is 0 something can be applied?
E.g:
<RULE> <WITH> <NOT> <EQUAL> <PROPERTY source="count" name="db.query"/> <NUMBER>0</NUMBER> </EQUAL > </NOT> </WITH> <DO> <PROPERTY name="VISIBLE" source="field_that_should_be_hided"/> </DO> </RULE>
I mean, it would be sufficient to check how many possible entries are in list fields like CMS_INPUT_LIST, but I don't find any fitting property (e.g. SIZE only returns the values that are selected by the user).
Alternative it would be possible to create a query that returns the count of the db query, put that value in an input field and use that value. But I also didn't find a way to create a query that returns only the count.
Best, Maik
-
Author: hoebbel - 8/17/2022 8:37
Dear Maik,
to solve the problem, you need a self-implemented service (FirstSpirit module) that provides the corresponding information (how many records would a corresponding query return). You can then query this service in a rule and react to the return value. You can find more information here:
<SCHEDULE/> Asynchronous rule execution
Best regards
Holger0 -
Author: Maikman83 - 8/17/2022 9:32
Hi Hoebbel,
thank you for your response.
Looks like a loot of steps for that small outcome.
But we will keep that in mind and try it when it's necessary.
Best, Maik
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare