Where clause in web application script

Avatar

Avatar
Validate 1
Level 2
tejashriw155148
Level 2

Likes

12 likes

Total Posts

70 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 5
View profile

Avatar
Validate 1
Level 2
tejashriw155148
Level 2

Likes

12 likes

Total Posts

70 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 5
View profile
tejashriw155148
Level 2

16-06-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

167 likes

Total Posts

386 posts

Correct reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

167 likes

Total Posts

386 posts

Correct reply

135 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile
Milan_Vucetic
MVP

16-06-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

Answers (1)

Answers (1)

Avatar

Avatar
Boost 5
Level 2
InMo
Level 2

Likes

8 likes

Total Posts

25 posts

Correct reply

12 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Level 2
InMo
Level 2

Likes

8 likes

Total Posts

25 posts

Correct reply

12 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
InMo
Level 2

17-06-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

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

InMo

Hi @tejashriw155148,

 

From error it looks like a { is missing in the code.

 

Although i checked the code again if it dont work try below code also.

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

Please try and test it, it should work.

 

Regards

tejashriw155148

Hi @InMo ,

 

Thanks for your reply. I have tried new logic but still getting error-

 

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

 

when I use only single where condition then its working fine but facing issue for OR condition.

 

Regards,

Tejashri