Start a new topic

Virtual Field Name reference

IOM has a built in function called Static field (field name) and I essentially want to use it but only in particular scenarios.

 

Without writing the code I am trying to do the following

 

If seed field = 'Y' then import field value = virtual field name

 

I have all the code figured out apart from how to reference the virtual field name. 

Can anyone point be in the right direction? 

Thanks!

Helen


Hi Helen,

Can you give me a bit more information on what you are trying to accomplish? While the scenario you listed could be accomplished through the API it could also easily be done through standard IOM functionality using the copy field function then applying a dictionary. Since the virtual field name is going to remain constant during the import the replacement value in the dictionary would just be the same name as the virtual field.

Thanks,

John

Hi John

 

I work at the same place as Helen, and she has asked me to follow up on this one, as I have now hit the same problem. I am trying to use the static field name to only populate if a seed field is populated.

We have to add an action to those people in a file who have a certain field in the file populated. The action is not in the file. It would be easiest for our data execs to have this built into the import, rather than having to run a second import, or run a global add after the import has taken place.

So I need something that says along the lines of :

If oField IsNot Nothing

If oField.Value.Trim "" Then

sReturn = Static field (field name)

Except I know it isn't going to be as simple as that!!

 

I'd rather not use dictionaries as there are several fields I will need to standard populate on this action, and that would mean a fair few dictionaries for one import.

 

Many thanks

 

Gemma

Helen and Gemma-


Did you ever get this working? I did something that I think is close to what you are trying to do. You can create a virtual field (mapped, but without a function) and use VB to fill-in what you want in that field, or in multiple fields.


This code below is adjusting the Letter Type (virtual field BK, which is mapped to the letter type, but no function applied) based on a couple things:

  1. First, it sets the default letter type to "General."
  2. It looks at an incoming field named Donation (column Y) that indicates if the gift is a memorial/tribute. If that field contains "Memorial" (it can be pet or person memorial in our case, otherwise we could use equals instead of contains), then the letter code fed to virtual field BK is changed to "Memorial"
  3. It then goes on to see if the donor gave us an address to which we should send a card (incoming field named Address (column AC). If they did, it changes the letter type to "Memorial-Card".
  4. At this point, if the gift wasn't a memorial, it would still have the General letter type.
  5. The VB goes on to look for tribute gifts with/without a card.
  6. At the end, it looks at incoming field Source (Column G) and changes the letter code to Telemarketing if was from the campaign.


I didn't copy the rest of the code, but it also does stuff like referencing the donor's Prospect Classification to assign our general ledger codes (Leadership donors go to a different fund at our organization).


I inserted this after Public Class Profile Inherits ImportOM.API.ProfileBase:


Public function GetColumn(ColumnName As String) As String

GetColumn = Import.Fields.GetByExcelName(ColumnName).Value

End function

Public sub SetColumn(ColumnName As String, StrValue as string)

Import.Fields.GetByExcelName(ColumnName).Value = StrValue

End sub


And this in the AfterConstituentOpen section:

'define source column names

Dim sSource = "G"

Dim sDonation = "Y"

Dim sAddress = "AC"


'define virtual column names

Dim vLetterCode = "BK"


'By default the lettercode will be General

SetColumn(vLetterCode, "General")


'Change the letter code if memory or honor is found

If GetColumn(sDonation).Contains("Memorial") Then

SetColumn(vLetterCode, "Memorial")


'if the record contains an address, add the card designation to the letter code

If GetColumn(sAddress).Length > 0 Then

SetColumn(vLetterCode, "Memorial - Card")

End if

End if


If GetColumn(sDonation).Contains("Tribute") then

SetColumn(vLetterCode, "Tribute")


'if the record contains an address, add the card designation to the letter code

If GetColumn(sAddress).Length > 0 Then

SetColumn(vLetterCode, "Tribute- Card")

End if


'Change the letter code if Telemarketing gift

If GetColumn(sSource).Contains("17TM") Then

SetColumn(vLetterCode, "Telemarketing")

End if

End If


I'm still learning this stuff, but it's amazing what can be done. I'm sure there are other ways to do the VB, but this has worked well for us. (you can use the column letters instead of defining them by a name, but I do the DIM statements so that it's easier to update if the incoming field order or number changes)

Hi Barbara


This is definitely going to be helpful! Thank you so much!


Kind regards


Gemma

Login or Signup to post a comment