Where clause in web application script | Community
Skip to main content
tejashriw155148
Level 4
June 17, 2020
Solved

Where clause in web application script

  • June 17, 2020
  • 2 replies
  • 2590 views

Hi,

 

I have created web application in ACC and added below code in script.

 

var contactID = ctx.recipient.@contactId;

/**Fetch Details from BroadLogRcp*/
var query = NLWS.xtkQueryDef.create(
{queryDef: {schema: "nms:broadLogRcp", operation: "select",
select: {
node:[{expr: "[delivery/@messageType]"},{expr: "[@address]"},{expr: "[@status]"},{expr: "[delivery/@label]"}, {expr: "[recipient/@managerID]"},{expr: "[@employeeID]"},{expr: "[delivery/@lastModified]"},{expr: "[delivery/@id]"},{expr: "@eventDate"},{expr: "[@recipient-id]"}]
},
where: {
condition:[{expr: "[@employeeID] = " + contactID} || {expr:"[recipient/@managerID] = " + contactID}]
},
orderBy: {
node:{expr: "@eventDate", sortDesc: "true"}
}
}});

 

 

Here "OR" condition is not working. Please help me to solve this issue.

 

Thanks,

Tejashri

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 Milan_Vucetic

Hi @tejashriw155148,

add boolOperator with AND or OR in your conditions.

<where>
<condition boolOperator="OR" expr={firstName}/>
<condition boolOperator="OR" expr={lastName}/>
</where>

Regards,

Milan

2 replies

Milan_Vucetic
Milan_VuceticAccepted solution
Level 9
June 17, 2020

Hi @tejashriw155148,

add boolOperator with AND or OR in your conditions.

<where>
<condition boolOperator="OR" expr={firstName}/>
<condition boolOperator="OR" expr={lastName}/>
</where>

Regards,

Milan

Level 3
June 17, 2020

Hi @tejashriw155148 ,

 

Where clause should be something like below

where: {
condition:[{expr: "[@employeeID] = " + contactID boolOperator: "OR"}
{expr:"[recipient/@managerID] = " + contactID} ]
}

 

Please check, it should work.

You can also refer to below page

https://blog.floriancourgey.com/2018/08/use-querydef-the-database-toolkit-in-adobe-campaign

 

Regards

tejashriw155148
Level 4
June 17, 2020

Hi @inmo@milan_vucetic  

 

where: {
condition:[{expr: "[@employeeID] = " + contactID boolOperator: "OR"}
{expr:"[recipient/@managerID] = " + contactID} ]
}

 

After adding the above code I'm getting below error

 

JST-310000 Error while compiling script '_webApp_APP118_' line 239: missing } after property list (line=' condition:[{expr: "[@employeeID] = " + contactID boolOperator:"OR"}{expr:"[recipient/@managerID] = " + contactID}]
' token='boolOperator:"OR"}{expr:"[recipient/@managerID] = " + contactID}]
').
SCR-160032 Javascript&colon; error while compiling script '_webApp_APP118_'.

 

Regards,

Tejashri