Filtering Individual Relationships

In my endeavour of documenting the undocumented I would like to present this little nugget of an unwritten feature. I wanted to filter a constituent’s individual relationship based on a reciprocal type and on the to date not being populated i.e. the relationship was still valid. I’ll use the filter object I thought.

I wrote the following code:

Dim inds As CIndividuals2 = Nothing
Dim ind As CIndividual2 = Nothing
Dim indsFilter As CIndRelFilter

inds = New CIndividuals2
inds.Init(REUtil.getSessionContext, constit.Fields(ERECORDSFields.RECORDS_fld_ID), _ &
TopViewFilter_Individual2.tvf_Ind2_UseFilterObject, , False)
indsFilter = inds.FilterObject
indsFilter.ReciprocalRelationshipType = "Friend"
indsFilter.DateTo = ""

For Each ind In inds
'do something
Next ind

This didn’t work. It just returned all the “Friend” relationships. I noticed that the actual value of the blank to date field is “Nothing” so I tried:

indsFilter.DateTo = Nothing

But no luck.

After a quick email to Blackbaud support I was informed that the DateTo filter does not support blank values. So there you go…Now it is documented somewhere at least.

What is the workaround? In this case use the custom where clause to check for a null date and compare against the table entry for the “Friend” entry. Not nearly as neat as using the filter object.

inds.Init REApplication.SessionContext, 280, tvf_Ind2_CustomWhereClause, "Date_To IS Null AND Recip_Relation_Code = X"

Here X is the table entry id for “Friend”