Advanced Filtering

Hello Everyone
Hope you are having a good day.

I have a question, please. 

Now i have the "Patient" Object. and under that patient there is an object "Consent" as the following.


Now, I have a code that do the following:
before we make that patient status as "Active" we need to have a consent ( Consent must have a file inside it before making the status of the patient Active)

The code: 

Const ApprovalDocumentsClassId = 37 'Consent Class ID
Const RelatedPatientPropId = 1054 'Pateint PropID
Const ConsentTypePropId = 2964 'ConsentType PropID

If Not IsApprovalDocumentAvailable(ObjVer.ID) Then
Err.raise mfscriptcancel, "No Patient Consent Form found for patient."
End If


Function IsApprovalDocumentAvailable(patientId)

Dim oScsP : Set oScsP = CreateObject("MFilesAPI.SearchConditions")
Dim oScP : Set oScP = CreateObject("MFilesAPI.SearchCondition")

oScP.Expression.DataPropertyValuePropertyDef = MFBuiltInPropertyDefClass
oScP.ConditionType = MFConditionTypeEqual
oScP.TypedValue.SetValue MFDatatypeLookup, ApprovalDocumentsClassId
oScsP.Add -1, oScP

oScP.Expression.DataPropertyValuePropertyDef = RelatedPatientPropId
oScP.ConditionType = MFConditionTypeEqual
oScP.TypedValue.SetValue MFDatatypeLookup, patientId
oScsP.Add -1, oScP

oScP.Expression.DataStatusValueType = MFStatusTypeDeleted
oScP.ConditionType = MFConditionTypeEqual
oScP.TypedValue.SetValue MFDatatypeBoolean, False 'Silinmemis
oScsP.Add -1, oScP


Set oSearchResultsP = Vault.ObjectSearchOperations.SearchForObjectsByConditions(oScsP,MFSearchFlagNone,False)

If oSearchResultsP.Count = 0 Then
IsApprovalDocumentAvailable = False
Else
IsApprovalDocumentAvailable = True
End If
End Function



Now, the point that i need help with is modifying this code to further search inside that consent type.

What i have inside the "Consent" object is this:

"Consent type"

I want my code to search not only if the class "Consent" is there for the patient, but also to look further for the type of that consent, if it is "General Consent for Treatment" or not.

Is that possible to do?

Thank you