0

I am trying to filter a data extension to only return certain rows via an SSJS automation.

It works fine if I set the SimpleOperator to "equals" and the Value to a static value.

What I really want to be able to do is filter on a number of values like this:

 var dataextensionexternalkey = 'externalkey';
 var dataExtension = DataExtension.Init(dataextensionexternalkey);
var filter = {Property:"LANGUAGE_CODE",SimpleOperator:"IN", Value:'"DA", "DE", "EN", "ES", "FR", "IT", "NL", "NO", "PL", "PT", "FI", "SV", "TR", "ZH"'};
var dataExtensionRows = dataExtension.Rows.Retrieve(filter);
Write('<hr>number of rows in filtered dataextension: ' + dataExtensionRows.length() + '<hr>');

But no rows are retrieved, it says: number of rows in filtered dataextension: 0

What am I doing wrong in the filter definition.

It works fine when I filter like this:

var filter = {Property:"LANGUAGE_CODE",SimpleOperator:"equals", Value:'EN'};
1

I found out how to make it work. You have to make an array of your IN values:

var availLanguagesArray = ["DA", "DE", "EN", "ES", "FR", "IT", "NL", "NO", "PL", "PT", "FI", "SV", "TR", "ZH"];
var filter = {Property:'LANGUAGE_CODE',SimpleOperator:'IN', Value: availLanguagesArray};

var sourceRows = sourceData.Rows.Retrieve(filter);

And Bob's your uncle...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.