Invert Data | Community
Skip to main content
alistairk396804
Level 3
March 21, 2017
Solved

Invert Data

  • March 21, 2017
  • 13 replies
  • 6110 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

alistairk396804
Level 3
March 28, 2017

Hi Amit,

We reached a working conclusion at about the same time :) I simply reversed by query criteria and used a 'contains' operator. No need to actually split the variable.

I'll need to test this further but I suspect this is will work as required. Appreciate all the help received!

Amit_Kumar
Level 10
March 28, 2017

alistairk39680404 wrote...

Hi Amit,

We reached a working conclusion at about the same time :) I simply reversed by query criteria and used a 'contains' operator. No need to actually split the variable.

I'll need to test this further but I suspect this is will work as required. Appreciate all the help received!

 

I know it will work but it will break if you pass null or empty values so it's better to split and cast to prevent the errors.

alistairk396804
Level 3
March 29, 2017

Hi Amit,

Due to the way the Delivery IDs are matched and generated for the soap call there will never be any instances where a null or empty value is presented.

However building in redundancy is always a good idea so I will look to implement your solution. Thanks for the insight on the push command!