If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#51359 by srufini
Wed Aug 14, 2019 2:49 pm
Hello,

I am trying an elegant way to create a condition for which all objects that are subitems of another objects satisfy a condition. For example

I want to check if there are any "Approval" objects that are parts of "DocIssue.Approvals" and have their Status as "Requested" or "Approved"

This is how I wrote the condition, but it doesn´t seem to work:

Code: Select allCOUNT Approval  WHERE ((Approval IN ThisDocIssue.Approvals) AND Approval.Status IN 'Requested','Approved' )>0


Thanks in advance for any help/Suggestion.

Sergio
#51360 by himanshu
Wed Aug 14, 2019 5:02 pm
Hi,

Your condition looks ok... just try to remove the inner brackets like below and make sure ThisDocIssue is present in the context.

COUNT Approval WHERE (Approval IN ThisDocIssue.Approvals AND Approval.Status IN 'Requested', 'Approved') > 0
#51363 by srufini
Thu Aug 15, 2019 9:33 am
Thanks for the quick answer.
I tried but still no luck.
I create in the form of the object DocIssue an HTML section where I copied this text to check the calculation.
I have 3 approvals in the DocIssue opened in this form and a total of 5 Approvals in the whole application.

Code: Select allDocIssue ID: <<DocIssue.ID>> <br>
<<COUNT Approval WHERE (Approval.Status='New')>><br>
<<COUNT Approval WHERE (Approval.ParentObject.ID=ThisDocIssue.ID)>><br>
<<COUNT Approval WHERE (Approval.ParentObject.ID=ThatDocIssue.ID)>><br>
<<COUNT Approval WHERE (Approval.ParentObject.ID=DocIssue.ID)>><br>
<<COUNT Approval  WHERE (Approval IN DocIssue.Approvals)>><br>
<<COUNT Approval WHERE (Approval IN ThisDocIssue.Approvals)>><br>


The result is:
Line 1)= 120 (the actual ID -> correct)
Line 2)= 5 (the total number of approvals in the business application)
Line 3)= 0
Line 4)= 0
Line 5)= 0
Line 6)= 0
Line 7)= 0


seems a very specific and stupid mistake. What am I doing wrong?

Thanks
#51364 by eagles9999
Thu Aug 15, 2019 10:27 am
Have you tried this....

COUNT Approval WHERE (Approval IN ThisDocIssue.Approvals AND (Approval.Status='Requested' OR Approval.Status='Approved'))>0

Depending on Context.... you may not need ThisDocIssue especially if DocIssue has been passsed as an input
#51365 by srufini
Thu Aug 15, 2019 10:43 am
Hi,

yes, still doesn´t work. The point is that does not even work the counting with one condition only:

COUNT Approval WHERE (Approval IN DocIssue.Approvals )
This always returns 0 either with "This" or not. But in the form I can clearly see the Approvals that are part of the object.attribute -> DocIssue.Approvals and there are 3!
#51366 by eagles9999
Thu Aug 15, 2019 10:48 am
I have PM'd you

Who is online

Users browsing this forum: No registered users and 22 guests