how I can do a test on an attribute of business variable of list type?

Hi;

On a gateway, I want to do a test on an attribute: observationResultStatus of a business variable of list type: obx.
Under a transition, I created the following script:
return
oru_R01.patientResult.patientOruR01.patientObservation.obx.forEach (obx.observationResultStatus == 'X').

I get this error:
Caused by: java.lang.NullPointerException: Cannot get property 'obx' on null object.

where is the problem or how I can do this test ?

I found a solution: 

I created a process variable : observationResultStatus as list;

and I added this script:

def n= false;
observationResultStatus.each {
    if ("${it}"=="X")
    {n= true;}
}
return n;