Any samples SegmentOptions in vb?

Mar 3, 2013 at 7:44 PM
Hello,

I had been doing OK with figuring out MCAPI in VB, until now. I am trying to create a new SegmentCondion and this whole MailChimp.Types.MCSeq(of String) has me confused.

Looking at the C# samples, it looks like I should be using the form:
Dim contdition As MailChimp.Types.Campaign.SegmentCondition =  _
    New MailChimp.Types.Campaign.SegmentCondition("interests-1", "one", New String() {"dog", "cat", "fish"})
Where interests-1 might represent the "Pets" interest group (with id=1)

Obviously what I am trying above is incorrect, so can anyone point me to an example in VB?
Coordinator
Mar 3, 2013 at 9:23 PM
Edited Mar 3, 2013 at 9:23 PM
So what is the problem with your example?

MCSeq(of String) is just a type that can be a string or a sequence of strings. It has implicit conversion operators. So you should not have any problem with it.
Mar 4, 2013 at 1:01 AM
Edited Mar 4, 2013 at 1:03 AM
Sorry, I forgot to post that bit in....

The statement above generates the compiler error:

Compiler Error Message: BC30311: Value of type '1-dimensional array of String' cannot be converted to 'MailChimp.Types.MCSeq(Of String)'.

I can Add just a single item is by using a simple string:
        Dim condition As MailChimp.Types.Campaign.SegmentCondition = _
        New MailChimp.Types.Campaign.SegmentCondition("interests-" & gId, "one", "Dog")
For dealing with the SegmentConditions, I was able to do this:
        Dim conditions As MailChimp.Types.MCList(Of MailChimp.Types.Campaign.SegmentCondition) = _
              New MailChimp.Types.MCList(Of MailChimp.Types.Campaign.SegmentCondition)
        conditions.Add(condition)
If I try something similar for the options:
Dim ary2 As MailChimp.Types.MCSeq(Of String) = New MailChimp.Types.MCSeq(Of String)
I get the error:

Compiler Error Message: BC30390: 'MailChimp.Types.MCSeq(Of T).Friend Sub New()' is not accessible in this context because it is 'Friend'.

I am sort of stuck trying to figure out how to add multiple interests.

Thanks for your help!
Mar 4, 2013 at 1:23 AM
Finally figured it out.....
Dim interests As MailChimp.Types.MCSeq(Of String) = _
 MailChimp.Types.MCSeqModule.parse(Of String)("Dog,Cat,Fish")

Dim condition As MailChimp.Types.Campaign.SegmentCondition = _
 New MailChimp.Types.Campaign.SegmentCondition("interests-" & gId, "one", interests)
Thanks so much for creating MCAPI!