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

Using variable inside <where> condition

Avatar

Avatar
Give Back 5
Level 3
marcinkacz
Level 3

Likes

19 likes

Total Posts

46 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile

Avatar
Give Back 5
Level 3
marcinkacz
Level 3

Likes

19 likes

Total Posts

46 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile
marcinkacz
Level 3

02-08-2017

Hi,

I'm hoping that you can help me again. My question is: how I can insert variable intName instead of 'OP125' inside <where> condition?

My code in JS workflow activity is:

var intName = 'OP125'

var query = xtk.queryDef.create( 

  <queryDef schema="xtk:workflow" operation="get">   

    <select>          

      <node expr="@label"/>

      <node expr="@internalName"/>

    </select>   

    <where>     

      <condition expr="[operation/@internalName] = 'OP125'"/>   

    </where> 

  </queryDef>)

var res = query.ExecuteQuery()

logInfo("///// My Label: " + res.@label)

Could you please help me with this issue?

Thank you,

Marcin

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

182 posts

Correct Reply

41 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

182 posts

Correct Reply

41 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
david_garcia1
MVP

03-08-2017

Hey Marcin,

Sorry I've forgot to include the brackets

      <condition expr={"@internalName = '"+intName+"'"}/>

also

If you use the following loop you can get an idea of the object keys available to you.

In the objects value, try also; task, task.workflow

Shall give you something like

javascript_test.JPG

so by doing logInfo(instance.label); It gives me the workflow title (screenshot https://db.tt/c1JVowRuhd )

Try playing around with these objects, not sure how to get the campaign name, because i am testing it on a normal workflow.

Answers (2)

Answers (2)

Avatar

Avatar
Give Back 5
Level 3
marcinkacz
Level 3

Likes

19 likes

Total Posts

46 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile

Avatar
Give Back 5
Level 3
marcinkacz
Level 3

Likes

19 likes

Total Posts

46 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 10
View profile
marcinkacz
Level 3

03-08-2017

Thank you for your response. Unfortunately this script returns error:

error_intName.PNG

Will you be so kind and give me some clues why?

BTW Do you know how to insert value into var intName dynamically? I mean, how to insert current campaign's internal name there?

Thanks,

Marcin

Avatar

Avatar
Validate 1
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

182 posts

Correct Reply

41 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
MVP
david_garcia1
MVP

Likes

106 likes

Total Posts

182 posts

Correct Reply

41 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
david_garcia1
MVP

02-08-2017

<condition expr="[operation/@internalName] = '"+intName+"'"/>  

That is (') singlequote, then (") doublequote and +variable+