Skip to main content
Nov 12, 2020 10:05 AM UTC
Question

Storing distinct field values as JS variables without knowing the data content

Hi guys,

 

I'm trying to create a Split activity based on distinct values of fielddata. I'm trying to fetch city centre data from regions. I tried this in JS:

 

var query = xtk.queryDef.create(
<queryDef schema="temp:enrich3" operation="select" distinct="true">
<select>
<node expr="city"/>
</select>
</queryDef>);
var resultSet = query.ExecuteQuery();
for each (var row in resultSet)
{​​​​​
vars.city = row.city;
logInfo(vars.city);
}​​​​​

 

This will return the following:

 

12/11/2020 09:57:21 PIJNACKER
12/11/2020 09:57:21 BLEISWIJK
12/11/2020 09:57:21 BERGSCHENHOEK
12/11/2020 09:57:21 ROTTERDAM
12/11/2020 09:57:21 DELFGAUW
12/11/2020 09:57:21 Pijnacker-Nootdorp
12/11/2020 09:57:21 BERKEL EN RODENRIJS
12/11/2020 09:57:21 NOOTDORP
12/11/2020 09:57:21 DELFT


I want each and every one of these values to be stored seperately with some kind of linenumber/rownumber so I can select them in a Split activity by saying something like vars.city1 is not empty and so on.

 

How can I do this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jonathon_wodnicki
Community Advisor
Community Advisor
Nov 18, 2020 4:22 AM UTC

Hi,

 

You'd need to use initialization script of split (or cells?) activity to dynamically alter the activity's transitions.

What is the goal of splitting on city?

 

Thanks,

-Jon

Translate
Aclypse10Author
Nov 18, 2020 8:13 AM UTC

Thanks, what would I put in there? I want for each variation to output a DM file in the end. The problem is that on forehand you do not know how many cities are held in the target. I target on regioncodes, so in advance I do not know how many cities belong to a specific regioncode. But for every city that comes out the target eventually, I want a seperate file to be generated for direct marketing activities.

Translate