If the status is in multiple records, you can't use a loop to do this. Instead, you'll need to use a couple of variables to track which of the statuses the test has and then calculate the final status in the group footer. The formula might look like this (you may have to tweak the location of some semi-colons...):
BooleanVar hasA;
BooleanVar hasB;
BooleanVar hasDone;
//initialize the variables for each group
If OnFirstRecord or {GroupingField} <> Previous({GroupingField}) then (
hasA := false;
hasB := false;
hasDone := false;
);
If {Status} = "OOS-A" then hasA := true
Else if {Status} = "OOS-B" then hasB := true
else if {Status} = "Done" then hasDone := true;
""
Put this formula in the details section - even if details are suppressed. The "" at the end makes sure nothing will actually show up on the report, but the formula will be processed.
If you want to just show the data about the test, suppress the group header and the details and put all of the test fields in the group footer. Then use the following formula to display the correct status:
BooleanVar hasA;
BooleanVar hasB;
BooleanVar hasDone;
If hasA then "OOS"
Else If hasB or hasDone then "Done"
Else {Status}
Because the logic is if A or (A and B) or (A and Done) or (A and B and Done), you only need to look for A to determine whether the status is A - you don't have to worry about any of the other tests because A is always a part of them.
The same type of thing applies for the logic for (not A) and (B or (B and Done) or Done) - you only have to check for either B or Done to determine if the status is Done.
-Dell