Hey there,
You need to change the format. Data in the memo field is just a string. So when you call that field in a workflow/delivery you need re-define its format/type. See below how the var xmlTrigger calls the memo field to a string then creates a new XML (doc). Once that occurs you can JSON.parse() that XML (if your object needs it). The code below can parse any object level information and write that back to the temp table so you can use it in targetData.
I used the below concepts to parse data from the XML+JSON data stored in ACC memo fields from the Analytics -Pipeline integration.
Here are two examples
XML specific
var res = xtk.queryDef.create (
<queryDef schema={vars.targetSchema} operation="select" >
<select>
<node expr="@data"/> <!-- this is the memo column--/>
<node expr="@account"/>
<node expr="@pageBrand"/>
</select>
<where>
<condition expr={"[@data] IS NOT NULL" }/>
</where>
</queryDef>
).ExecuteQuery();
for each (var msg in res){
var xmlTrigger = new XML( msg.@data.toString() ); //this is prep
var enrichments = JSON.parse(xmlTrigger.enrichments.toString()); //this is prep
var pageBrand = enrichments.analytic**bleep**Summary.dimensions.eVar1.data[0]; //map your data
var prod1 = enrichments.analytic**bleep**Summary.products.cartAdditions.data[0].name; //map your data
//logInfo("pageBrand: " + pageBrand )
var upTempTable = <enrich xtkschema={vars.targetSchema} _operation="update" account={msg.@account} pageBrand={pageBrand} prod1={prod1} _key="@account" />;
xtk.session.Write(upTempTable);
}
Storing JSON in a memo field
var res = xtk.queryDef.create (
<queryDef schema={vars.targetSchema} operation="select" >
<select>
<node expr="@eventPayload"/> <!-- this is my JSON memo field--/>
<node expr="@account"/>
<node expr="@question_1"/>
<node expr="@question_2"/>
</select>
<where>
<condition expr={"[@eventPayload] IS NOT NULL" }/>
</where>
</queryDef>
).ExecuteQuery();
for each (var msg in res){
var parseObj = JSON.parse( msg.@eventPayload );
//map in the details from the JSON responses to use in a workflow
var ansOne = parseObj.event.responseDetails.selection.answer_1;
var ansTwo = parseObj.event.responseDetails.selection.answer_1;
var upTempTable = <query xtkschema={vars.targetSchema} _operation="update" _key="@account" account={msg.@account} question_1={ansOne} question_2={ansTwo} />;
xtk.session.Write(upTempTable);
}