A condition for a dynamic attribute is required

Hello,

There is a task: it is necessary to show an element if in the returned query to the database, all records on one field have identical values and are not equal to zero.

What will such a condition look like and how best to do it?

Thanks in advance!

Can you provide a more specific example of what are you trying to do, as it’s not very clear from your explanation?

There is a button

I need a condition that the following happens:

  1. If the query to the database returns the following results:
    1
    Button is shown.

  2. If the query to the database returns the following results:
    2
    Button is not shown.

  3. If the query to the database returns the following results:
    3
    Button is not shown.

  4. If the query to the database returns the following results:
    4
    Button is not shown.

You can do this with a set value step after your query. So you need to group the query by your column and check if it returns more than one result, then you also need to check if the returned value is equal to 0.

So this will be the setvalue step expression:

{{query1.groupBy("field1").keys().count() == 1 && query1.groupBy("field1").keys()[0] != 0}}

It will return true if the results are the same and not equal to 0.
Enable the output option for the setvalue step and use it as an expression on your page with the dmx-show attribute