I am trying to query the database through a script in a web app, but when providing the country location in the database, it is throwing an error. The folder is gmlocation/country under recipients. This is the error below.
Attribute 'country' unknown (see definition of schema 'Recipients (nms:recipient)'). XTK-170036 Unable to parse expression '@country='CAN''. SOP-330011 Error while executing the method 'ExecuteQuery' of service 'xtk:queryDef'.
Here is an sample of the script I am trying to query.
var query = xtk.queryDef.create(
<queryDef schema="nms:recipient" operation="getIfExists">
<select>
<node expr="@email"/>
<node expr="@id"/>
</select>
<where>
<condition expr={"@email='"+ctx.recipient.@email+"'"}/>
<condition expr={"@sourceType='Media'"}/>
<condition expr={"@country='CAN'"}/>
</where>
</queryDef>
Views
Replies
Total Likes
Hello @StrawHatM23,
country is to found under [location/@countryCode] and it is ISO A2 not A3 so you condition should be
<condition expr={"[location/@countryCode]='CA'"}/>
Marcel Szimonisz
MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/
Views
Replies
Total Likes
I am still receiving an error. Here is a screenshot of my configure list.
I tried using
<condition expr={"[gmLocation/@country]='CAN'"}/>
Views
Replies
Total Likes
Hello @StrawHatM23
Must be missing something.
Please share your latest error, and if possible share the schema definition for [gmLocation/@country]
Generating queryDef query should be simple with below steps:
1/ Navigate to schema; Data tab
2/ Use Advanced filter and apply your query filter
3/ Ensure the results are loaded
4/ Re-open the filter; Right-click and choose Edit XML source...
Hope this helps!
Views
Replies
Total Likes
Views
Likes
Replies