Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Creation of variables from a list in Adobe

valentinn903812
Level 1
Level 1

Hello everyone,

Does anybody know how to declare a variable on Adobe from a list ?

I have a list with 4 columns and I want to create a variable for each cells of the list : that means for each line there will be 4 variables (the final aim is to put the variables in a delivery ). I think I should use a Javascript but I don't know what to put inside...

Furthermore I have another question, I don't find in documentation if global variables exist. I mean a variable created in a workflow (A) that can be used/modified by the workflow (B) even if the WF (A) is not running.

Thanks for your help,

Regards,

Valentin

1 Accepted Solution
Vapsy
Correct answer by
Employee
Employee

Hi Valentin,

  • Create an option under Administration > Platform > Options by the name of your choice say "MyWkfCount" and type text.
  • Add a JS activity right after the activity which is supposed to give your record count.
  • Keep this line of code setOption("MyWkfCount", vars.recCount);

For the List variables, best will be to use an array.

From the schema tab of query activity you can get the schema name, probably it will be temp:query

You can then use this code

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@use"/>

      <node expr="@label"/>

      <node expr="@[D_1]"/>

      <node expr="@[D_2]"/>

      <node expr="@[D_3]"/>

      <node expr="@[D_4]"/>

      <node expr="@[D_5]"/>

    </select>

  </queryDef>);

var results = query.ExecuteQuery();

var data= [];

for each (var result in results) {

     data[0] = result.@use;

     data[0] = result.@label;

     data[0] = result.@[D_1];

     data[0] = result.@[D_2];

     data[0] = result.@[D_3];

     data[0] = result.@[D_4];

     data[0] = result.@[D_5];

}

View solution in original post

5 Replies
Vapsy
Employee
Employee

Hi Valentin,

The term global variables is called as Options in Campaign.

If you are on ACC, you can set an option on one workflow calling setOption Javascript function and then on the other workflow use a getOption function.

Vapsy
Employee
Employee

I'm not very clear of your first use case. Can you please elaborate more?

valentinn903812
Level 1
Level 1

Hi Vipul,

Thanks for your answer and your help. Do you have an example of script for the first case ? I want to store in a variable the number of sets in a workflow using vars.recCount. I don't know exactly how to use the function setOption with recCount.

For your second answer and my first point, I'll illustrate step by step what I want to do. So I would like to create as many variables as possible from a list read. 1544374_pastedImage_0.png

I mean I want to create 7 variables in this case (for each "cells"). 1544381_pastedImage_1.png

Do you have any idea about how I can do that ?

Thanks for your time.

Regards,

Valentin

Vapsy
Correct answer by
Employee
Employee

Hi Valentin,

  • Create an option under Administration > Platform > Options by the name of your choice say "MyWkfCount" and type text.
  • Add a JS activity right after the activity which is supposed to give your record count.
  • Keep this line of code setOption("MyWkfCount", vars.recCount);

For the List variables, best will be to use an array.

From the schema tab of query activity you can get the schema name, probably it will be temp:query

You can then use this code

var query = xtk.queryDef.create(

  <queryDef schema="temp:query" operation="select">

    <select>

      <node expr="@use"/>

      <node expr="@label"/>

      <node expr="@[D_1]"/>

      <node expr="@[D_2]"/>

      <node expr="@[D_3]"/>

      <node expr="@[D_4]"/>

      <node expr="@[D_5]"/>

    </select>

  </queryDef>);

var results = query.ExecuteQuery();

var data= [];

for each (var result in results) {

     data[0] = result.@use;

     data[0] = result.@label;

     data[0] = result.@[D_1];

     data[0] = result.@[D_2];

     data[0] = result.@[D_3];

     data[0] = result.@[D_4];

     data[0] = result.@[D_5];

}

View solution in original post

valentinn903812
Level 1
Level 1

Hello Vipul,

Thanks a lot for your help and your time.

I succeeded to use the global variables with setoption and getOption and I'm now tackling the issue on the list.

Regards,

Valentin