setAudienceID

The setAudienceID method defines the AudienceID for the setAudience and startSession commands.

setAudienceID(audienceID)
  • audienceID-an array of NameValuePair objects which define the AudienceID.

Return value

None.

Example

The following example is an excerpt from an executeBatch method calling startSession and setAudience.

NameValuePair custId = new NameValuePairImpl();
custId.setName("CustomerId");
custId.setValueAsNumeric(1.0);
custId.setValueDataType(NameValuePair.DATA_TYPE_NUMERIC);
NameValuePair[] initialAudienceId = { custId };
. . .
Command startSessionCommand = new CommandImpl();
startSessionCommand.setAudienceID(initialAudienceId);
. . .
Command setAudienceCommand = new CommandImpl();
setAudienceCommand.setAudienceID(newAudienceId);
. . .
/** Build command array */
Command[] commands = 
    { 
        startSessionCommand,
        setAudienceCommand,
    };
/** Make the call */
    BatchResponse batchResponse = api.executeBatch(sessionId, commands);
        
/** Process the response appropriately */
    processExecuteBatchResponse(batchResponse);