campaignUpdate segment_opts

Dec 10, 2010 at 7:12 AM

how do you use it to update setment_opts?

i'm doing this but it fails:

 

                // Segment options
                var condition = new campaignSegmentCondition();

                condition.extra = string.Empty;
                condition.field = "date";
                condition.op = "lt"; // Less than
                condition.value = string.Format("{0:yyyy-MM-dd}", updateRow.SubscribedDateTo); // YYYY-MM-DD
                conditions.Add(condition);

Then i add "campaignSegmentCondition" like so:

input.parms.value = condition;

doesn't work. what am i doing wrong?

 

also, can you add/modify/update multiple conditions with one call?

thanks

Coordinator
Dec 10, 2010 at 1:25 PM

You're close, but to answer your question

...also, can you add/modify/update multiple conditions with one call?

... not only can you, but you have to from a certain point of view... segment conditions are updated as a set of one or more conditions along with a 'match' indicator

... anyway, the 'name' has to be "segment_opts"  -- here is a code fragments as example....

 

         // --------------------------------------
         campaignSegmentOptions seg = new campaignSegmentOptions();
         seg.match = "any";
         // one or more conditions
         var condition = new campaignSegmentCondition();
         condition.extra = string.Empty;
         condition.field = "date";
         condition.op = "lt"; // Less than
         condition.value = string.Format( "{0:yyyy-MM-dd}", updateRow.SubscribedDateTo ); // YYYY-MM-DD
         seg.conditions.Add( condition );
         //
         condition = new campaignSegmentCondition();
         condition.field = "initials";
         condition.op = "eq";
         condition.value = "dbm";
         seg.conditions.Add( condition );
         //
         input.parms.name = "segment_opts";
         input.parms.value = seg;
         // --------------------------------------


hope that helps

David

 

 

 

Dec 10, 2010 at 7:26 PM

thanks so much!. it works perfecteeeeee!.

:)