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

Can we store instance variable into an array?

Avatar

Avatar
Validate 1
Level 1
saishag86196293
Level 1

Likes

4 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 1
saishag86196293
Level 1

Likes

4 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
saishag86196293
Level 1

17-09-2018

Using queryDef am fetching a no sql field (an XML say 'ctx') field. Is there is any way to store the results in the array and then use the enrichment so that I can add these variables to the final data?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Employee
nainyjain
Employee

Likes

10 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Employee
nainyjain
Employee

Likes

10 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 1
View profile
nainyjain
Employee

17-09-2018

Hi saishag86196293 ,saishag86196293

You can store the query results in an array using for each loop in the query result and store it in vars to use it further in upcoming activities.

1573219_pastedImage_0.png

Below is the code text:

var query = xtk.queryDef.create( 

  <queryDef schema="xyz:transient" operation="select">   

    <select>     

      <node expr="@id"/>     

      <node expr="@campId"/>     

      <node expr="@recCount"/>   

    </select>       

  </queryDef>)

var res = query.ExecuteQuery()

//Creating array to store all Id's

id = []

for each (var t in res.transient){

id.push(t.@id)

}

logInfo('id array' + id);

//Store id array in vars to use it in next activities

vars.idArray = id;

logInfo('vars.idArray ' + vars.idArray);

Thanks,

Nainy Jain

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

19-09-2018

Hi saishag86196293,

When you will try to access this in the next activity, the array automatically gets converted to a comma separated string and hence you will have to split the variable and regenerate the array.

Regards,
vipul