Performing Logical AND on a TestStand Array

Updated Oct 23, 2024

Reported In

Software

  • TestStand

Issue Details

I have an Boolean Array in TestStand that I would like to perform an AND function on, giving a True only if all array elements are true.

How can I do this?

Solution

Depending on your situation, there are multiple solutions you can perform:

  • You can call into your preferred programming language and perform the operation there. For example, in LabVIEW you can call a code module with the array as an input and use the And Array Elements function

Logical AND.png

  • If you prefer to do the AND within TestStand, you can use the AllOf function. This approach only works if you know the size of your array/fixed-size arrays
  • If you have a dynamic array and want to do the calculation in TestStand, we can not directly perform a logical AND, but we can do a check to see if any elements of the array are false which is functionally the same. to do this, we first use the Sort function in TestStand. This puts all False contained in the Array to the front. Therefore, we can then read the first value of the Array (element 0) and if that is False, there was at least one False in the Array so the logical AND result is False. Alternatively, if we read a True, that means there were no False present, therefore the result of the Logical AND was True.