Start a new topic

Adding Yes/No attribute

Greetings - 

I'm trying to conditionally add a yes/no attribute using the API. Sounds like it should be simple but I'm missing something. The code looks like this:


If import.Fields.GetByName("Relation").value="Father" Then
import.Fields.GetByName("Parent Contact").value = "Yes"

"Parent contact" is a constituent attribute of type 'yes/no' and has been added as a virtual field. 

Any ideas? Thanks!


Thanks for adding that tip Nic. It helped solve another problem I was having.
Martin,

A good suggestion for something like this is to always compare with ToUpper() or ToLower(). These are built in methods off of a string.
Any time, I'm glad it was easy!
The problem was the mixed case of the data in the input file. The input file had 'FATHER' - all caps.
Thanks for the help Wayne!
is this in a custom function?

If you run it through the code tester you should be able to see more exactly what is going on.

Make sure of the capitalization of the input data and that there are no weird spaces or anything.

This code snippet looks good (other than the missing End If).
There is no else. I only want to populate the field if it's a 'yes. in this case.
The code editor shows no errors and the import runs without adding the attribute, even though there records that meet the condition.
What is happening? Is there an else?
Login or Signup to post a comment