DYO: Count number of True Flags
|
Q: Is there a way (easy I hope) to create the following DYO? I want the study flags on e.g. 5 conditions A...E. I want the total number of Trues and Sum number of Falses at any moment. I cannot seem to get there in an efficient way.
A: The first suggestion is to use the functions:
Global Flag | Count True[#] and Count False[#] which return the number of True and the number of False flags in the
GV set of size # starting with Read GV reference.
In this example. Global Flag | Count True[#] with #=4 and Read GV=1 would return the number 3.
The other way would be to work with the True flag's value of 255. A TRUE flag is the value 255. So in the example above, the Sum of 4 flags of which 3 are True totals 765. The number of True flags in the set would be the Sum / 255 = 765 / 255 = 3. A False flag has a value of zero. Either suggestion should help you in your design of counting the number of flags.
read more » DYO: Testing 2 of 3 True Flags
Last modified 8/26/09 4:42 PM
|