Start a new topic

Primary Education Flag

Hi, we switched to RE from Millennium in June of 2014.  I’m trying to import Graduates into our system and trying to get the primary education field to be checked only when we need it to be.

Here are our rules:

·         If this is the graduate’s first degree at Texas State, we want to mark it as the primary education row. 

·         If this is not their first Texas State degree, we do not want to mark the education row as primary. 

·         If this is not their first degree, but any existing degrees are not from Texas State, we want to mark the new one as primary.

Below is the code.  It seems to work, but I am wondering if there is a way to edit the Primary education value, without having to create a virtual column in my import.  I created a virtual column that marks every new education row as primary.  My code below looks to see if there is an existing education row where Texas State University is the school and is marked primary.  If one is found, the code changes the virtual column to not mark the record as primary.

Here’s my question, is there a better way to do this?  I see that there is a configuration option to “Mark education record as ‘Primary’ if it is the first to be added to a constituent.”  Is there a way I can manipulate this instead?  Looking for best practices since this is my first tweak.  There was not a lot of documentation I could find.  I’m hoping there is an API table at BBCON.  =)

Here is the code:

Public Overrides Sub AfterConstituentOpen(ByVal oRec As CRecord, ByVal Cancel As iCancel)

                MyBase.AfterConstituentOpen(oRec, Cancel)

                Dim oEd As Blackbaud.PIA.RE7.BBREAPI.CEducation

                Dim count = 0
'Education is set to primary by default if it is the first

                For Each oEd In oRec.Relations.Education

                       ‘msgbox(oEd.Fields(EEDUCATIONFields.EDUCATION_fld_SCHOOL_ID))

                       ‘msgbox (oEd.Fields(EEDUCATIONFields.EDUCATION_fld_PRIMARY_ALUMNI_INFO))

                               

                                If(( oEd.Fields(EEDUCATIONFields.EDUCATION_fld_SCHOOL_ID) = "Texas State      University" )and (oEd.Fields(EEDUCATIONFields.EDUCATION_fld_PRIMARY_ALUMNI_INFO)=-1))Then

                                        msgbox("this is a primary education.  break out of loop and increment count")

                                        count = count +1

                                         Exit For

                                Else

                                    msgbox("this is an education row, but not marked as primary.  do not increment count")                                                                                                                             

                                End If                   

                Next oEd

                               

                If count =0 Then

                                msgbox(" we are importing the primary, do nothing")

                Else

                                msgbox("there is already a primary education so make this row not primary")

                                Import.Fields.GetByExcelName("BA").Value = 0

                End if

                               

End Sub

 

Login or Signup to post a comment