05-23-2024 09:50 AM - edited 05-23-2024 09:57 AM
@abimkeren. wrote:
you mant to OR a boolean scalar with an input array of booleans, which is resultiung in an output array of booleans, but the stopp-while-loop terminal only accepts scalars.
e.g.
i haven't tested in detail, but it looks like "merge errors" is in this context equivalent to "and array elements", using two errors
f and f = true
f and t = false
t and f = false
t and t = true
05-23-2024 10:13 AM
@alexderjuengere wrote:
i haven't tested in detail, but it looks like "merge errors" is in this context equivalent to "and array elements", using two errors
f and f = true
f and t = false
t and f = false
t and t = true
Sorry, could you explain this more? Merge Errors acts like an Or, not an And.
Two error constants with "status" set to False run through a Merge Errors gives False.
Either one, or both, with "status" set to True will return True.
05-24-2024 10:10 AM
@BertMcMahan wrote:
Sorry, could you explain this more? Merge Errors acts like an Or, not an And.
Two error constants with "status" set to False run through a Merge Errors gives False.
Either one, or both, with "status" set to True will return True.
As explained in the help, it checks the error in order and finds the first one and that will be reported in the other fields of the output cluster (error number, description, etc.)
QUOTE: "By default, this function looks for errors beginning with the error in 0 parameter and reports the first error found. If the function finds no errors, it looks for warnings and returns the first warning found. If the function finds no warnings, it returns no error. Use exception control to treat what is normally an error as no error or to treat a warning as an error."
05-24-2024 10:23 AM
@niravdesai wrote:
Use unbundle by name and use error status of each error and do logical OR of each error status then stop if true condition works ok and broken error will be removed
Don't overcomplicate things. Nobody needs to unbundle anymore. (Decades ago was different)
Nowadays, Boolean operations and conditional loop terminals accept error clusters directly. Mix & Match!
These examples all work as expected:
05-24-2024 10:28 AM
@altenbach wrote:
@BertMcMahan wrote:
Sorry, could you explain this more? Merge Errors acts like an Or, not an And.
Two error constants with "status" set to False run through a Merge Errors gives False.
Either one, or both, with "status" set to True will return True.
As explained in the help, it checks the error in order and finds the first one and that will be reported in the other fields of the output cluster (error number, description, etc.)
QUOTE: "By default, this function looks for errors beginning with the error in 0 parameter and reports the first error found. If the function finds no errors, it looks for warnings and returns the first warning found. If the function finds no warnings, it returns no error. Use exception control to treat what is normally an error as no error or to treat a warning as an error."
I understand, I was referring to @alexderjuengere's comment that it acted like an And, with F and F returning True. That made no sense to me so I was trying to understand what he was talking about. In the context of this application, Merge Errors acts as an Or.
(Specifically referring to whether or not the Stop terminal would trigger. Obviously Or'ing the array would strip out all warnings, error codes, etc.)
Also, we have the option now to keep *all* of the errors with a right-click selection to "Retain All Errors" since about 2021 or so. I haven't played with it much but it seems promising. This too doesn't make a bit of difference to the OP's question, so I digress.
05-24-2024 12:47 PM
@BertMcMahan wrote:
Merge Errors acts as an Or.
Yes, if we only focus on the booleans, as e.g. the only way the stop terminal understands.
As a quick exotic diversion for the weekend, let's remember that "AND array elements" of an empty boolean array is TRUE. Intuitive once you think a bit... 😄
05-24-2024 02:55 PM
@altenbach wrote:
@BertMcMahan wrote:
Merge Errors acts as an Or.
Yes, if we only focus on the booleans, as e.g. the only way the stop terminal understands.
As a quick exotic diversion for the weekend, let's remember that "AND array elements" of an empty boolean array is TRUE. Intuitive once you think a bit... 😄
An excellent post by Kevin Price describing why this is the case:
05-24-2024 10:57 PM
@altenbach wrote:
@BertMcMahan wrote:
Merge Errors acts as an Or.
Yes, if we only focus on the booleans, as e.g. the only way the stop terminal understands.
As a quick exotic diversion for the weekend, let's remember that "AND array elements" of an empty boolean array is TRUE. Intuitive once you think a bit... 😄
This will bite you if you have a FOR loop iterating through an array of test data and for some reason that array is empty going into the FOR loop. The array of Booleans representing P/F status will be empty, resulting in a false PASS. So make sure to handle that possibility.
05-25-2024 05:30 AM
@alexderjuengere wrote:
@abimkeren. wrote:
you mant to OR a boolean scalar with an input array of booleans, which is resultiung in an output array of booleans, but the stopp-while-loop terminal only accepts scalars.
e.g.
i haven't tested in detail, but it looks like "merge errors" is in this context equivalent to "and array elements", using two errors
f and f = true
f and t = false
t and f = false
t and t = true
That logic table looks like an EXOR NOT! That is even another thing than OR or AND. And the merge error definitely works as OR. It returns the first error in the list that is TRUE or no error if none is TRUE.
05-25-2024 10:12 AM
@billko wrote:
This will bite you if you have a FOR loop iterating through an array of test data and for some reason that array is empty going into the FOR loop. The array of Booleans representing P/F status will be empty, resulting in a false PASS. So make sure to handle that possibility.
Why would that be a false PASS?
Is TRUE Pass or Fail?
Conventionally, Fail=TRUE and you would use OR array elements to see if there is at least one failure. An empty array would PASS.
OTOH, if you define Pass=TRUE, you would use AND array elements to see if there is at least one failure. An empty array would PASS.
An empty array means that no failures exist and no corrective action is needed. If you want to fail if there are no results, both scenarios need a touchup as discussed elsewhere. I have the feeling that empty results should probably be caught upstream already..
Here's is equivalent code for both: