Invert Data | Community
Skip to main content
alistairk396804
New Participant
March 21, 2017
Solved

Invert Data

  • March 21, 2017
  • 13 replies
  • 6109 views

Hi,

I have some data in this format;

Record  Var1    Var2 1       00001   00002

but only want to query a single variable in my query so;

Record  Var 1       00001 2       00002

Is there an easy way to do this? I'm looking online but all of the solutions I've found are far more complex and often incompatible with Campaign.

Better yet - if there was a way to take the array value like this;

(00001,00002,etc)

And do the same that would be a better solution. Ideally this needs to by dynamic and create as many new rows as there are possible variables.

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

Hi Alistair,

Here is your working solution.

var listOfIds  = new Array(); for each (var sub in String(vars.varName).split(',')) listOfIds.push(parseInt(sub)); vars.listOfIds = listOfIds;      

Regards,

Amit

13 replies

Amit_Kumar
New Participant
March 27, 2017

alistairk39680404 wrote...

A bit more detail if it's helpful;

I am passing through a string of deliveryids in a soap call.
 
  1. xtk.workflow.PostEvent('WKF129','signal','', <variables varName= {vars.myVar} />,false)
in this instance varName = 4242971,4241831
 
In my called workflow I want to take varName and transpose each result into a new row so I end up with the following;
 
 
  1. Row varDevId
  2. 1 4242971
  3. 2 4241831

This would also need to be dynamic so that if I pass through multiple results in varName that it will create as many rows as needed.

 
Once I have this I intend to use this single variable to query against nms.delivery in order to pull the delivery details for these delivery IDs as below;

All online solutions use unsupported functions such as myVar.map (function())

 

Hi Alistair,

did you tried following:

var listOfIds = NL.XTK.toString(varName).split(',');

 

Regards,

Amit

vraghav
Employee
March 26, 2017

Hi Alistair,

You can use the variable containing comma separated values directly along with "is included in" operator.

It will help you to query for all deliveries in one go.

Regards,

Vipul

alistairk396804
New Participant
March 21, 2017

A bit more detail if it's helpful;

I am passing through a string of deliveryids in a soap call.
 
xtk.workflow.PostEvent('WKF129','signal','', <variables varName= {vars.myVar} />,false)
in this instance varName = 4242971,4241831
 
In my called workflow I want to take varName and transpose each result into a new row so I end up with the following;
 
Row varDevId 1   4242971 2   4241831

This would also need to be dynamic so that if I pass through multiple results in varName that it will create as many rows as needed.

 
Once I have this I intend to use this single variable to query against nms.delivery in order to pull the delivery details for these delivery IDs as below;

All online solutions use unsupported functions such as myVar.map (function())