Start a new topic

Accessing education attributes

I'm having an issue with accessing the "category" field values in RE. Included below is the code, bolded the text where the issue is.

I can retrieve the attribute type ID no problem but putting that into the oAttrTypesServer.GetAttributeTypeDescription() function returns nothing so I'm unsure where the issue lies.

Modified slightly to loop through oRec attributes and omit looping through education attributes this code works fine - is there a specific "typeserver" for education attributes?

 

Dim oEd As Blackbaud.PIA.RE7.BBREAPI.CEducation
Dim oAttrTypesServer As New Blackbaud.PIA.RE7.BBREAPI.CAttributeTypeServer
Dim oAttribute As Blackbaud.PIA.RE7.BBREAPI.IBBAttribute
Dim lTypeId As Long 

oAttrTypesServer.Init(Import.SessionContext)


For Each oEd In oRec.Relations.Education

	If oEd.Fields(EEDUCATIONFields.EDUCATION_fld_SCHOOL_ID) = "Foo University" Then


		For Each oAttribute In oEd.Attributes

			lTypeId += oAttribute.Fields(Blackbaud.PIA.RE7.BBREAPI.EattributeFields.Attribute_fld_ATTRIBUTETYPES_ID)

			Select Case oAttrTypesServer.GetAttributeTypeDescription(lTypeId)

				Case "Foo"
					oRec.Relations.Remove(ERelationshipTypes.rtyp_Education, oEd)

			End Select

		Next oAttribute


	End If

Next oEd

 


Hi Travis, the issue is in one of your lines of code. You are adding the typeId to the previous typeid instead of replacing the previous value. Change the '+=' to '+' and it should work fine. Here is the line as you have it:

lTypeId += oAttribute.Fields(Blackbaud.PIA.RE7.BBREAPI.EattributeFields.Attribute_fld_ATTRIBUTETYPES_ID)

Here is what it should be:

lTypeId = oAttribute.Fields(Blackbaud.PIA.RE7.BBREAPI.EattributeFields.Attribute_fld_ATTRIBUTETYPES_ID)

Have a great day.

Jim
Thank you for the response Jim. That was indeed the issue and I can't believe I missed that!!! 
Login or Signup to post a comment