Solved
Querydef using IN operator in Where clause
Hi,
I'm trying to get data from a schema using the following query but it doesn't work. Because it doesn't recognize the IN operator. Is there another way to do this? My goal is to calculate the maximum sales from each product. So after this i want to do a calculation but first i need the data...
var query = xtk.queryDef.create(
<queryDef schema={vars.targetSchema} operation="select" distinct="true">
<select>
<node expr="@id"/>
</select>
</queryDef>);
var results = query.ExecuteQuery();
var primarykeys = []
for each (var row in results){
primarykeys.push(row.@id)
}
logInfo(vars.primarykeys)
var querys = xtk.queryDef.create(
<queryDef schema="cus:products" operation="select">
<select>
<node expr="@sales"/>
<node expr="@productID"/>
</select>
<where>
<condition expr={"@RecipientId " in "'"+primarykeys+"'"}/>
</where>
</queryDef>
)
var result = querys.ExecuteQuery()Thank you in advance 🙂
Kind regards,
J