How to check if an entity already contains a record with an attribute set to True

If someone would be able to assist me with this it would be great.

I have an entity which contains a number of records.  These records are entered by users filling in a form and on that form there is a check box which can be set to True.  If the user then comes back and wishes to add a second record using the same form I want to be able to test the existing records to see if they have already added a record with this checkbox ticked i.e. True.  I believe that this has to be done in the preparation of the screen and should consist of using a "For Each" iteration with an IF test, but for the life of me I can't seem to get anything to work.  

Can someone produce a simple flow diagram of what I would have to do to get this to happen.

If the preparation finds that there is a record in the DB that has this attribute ticked then it should not show that field to the user.  (Again, I think this is done with the visible field being set to the value of a local variable.)

Any help would be appreciated.

Regards  Chris.


Hi Christopher,

In the preparation you just need to have an aggregate that gets all the records that have that variable set to true.

Than check if that aggregate is empty or not. If it's not it means that least one has that field set to true and you can hide the checkbox.




Marcelo Ferreira wrote:

Than check if that aggregate is empty or not. 

OK, I have the aggregate which has been filtered for the condition. i.e. the boolean attribute is True but how do I then test to see if it is empty or not?



Marcelo, thank I have it:  list.empty in an IF statement works.  Brilliant.  Thank you.