How can I get my variable value into quote " "?
Hi everyone!
I have the following js script to pass the value gridversion to delivery.
The result is OK but the value is not passed to the delivery with double quote " "
---
var query = xtk.queryDef.create(
<queryDef schema={vars.targetSchema} operation="select">
<select>
<node expr="@mongoId"/>
<node expr="@email"/>
<node expr="@scoring"/>
<node expr="@profil"/>
<node expr="@gridVersion"/>
</select>
</queryDef>
);
result = query.ExecuteQuery();
for each (var e in result) {
logInfo(e.@scoring +";"+ e.@profil +";"+ e.@mongoId);
var recipientScoring = e.@scoring;
var mongoId = e.@mongoId;
var recipientProfil = e.@profil;
var gridVersion = e.@gridVersion;
//for statement
if (recipientScoring == "RFM10" && recipientProfil == 1111) {
gridVersion = 1
logInfo("gridVersion:" + gridVersion)}
if (recipientScoring == 'RFM10' && recipientProfil == 1000) {
gridVersion = 2
logInfo("gridVersion:" + gridVersion)}
else {
logInfo("gridVersion:" + 'DEFAULT')}
sqlExec("UPDATE " + vars.tableName + " SET iGridVersion="+ gridVersion +" where sMongoId= '" + mongoId + "'");
// Declaration de variable
instance.vars.tableName = "gridVersion"
--
In the delivery tabs/advanced settings, I have:

And under Delivery Tabs/variables, I have:

My result is:

Expected result should be:

Anyone knows how I can fix this? Thanks in advance!