Exporting XML Fields

sagil23995776

27-08-2017

Hi,

Is it possible by any way to export an XML field value to a .csv through a workflow?

for example if I wish to export emails subject lines to a file.

Thanks,

Sagi

Accepted Solutions (1)

Accepted Solutions (1)

Jean-Serge_Biro

MVP

28-08-2017

Hi There,

In order to be clear, the expected code should work for this 2 examples:

Case 1 Subject field -

<%

if (targetData.target.age > 18)

{

%>

ADULT

<%

}

else

{

%>

MINOR

<%

}

%>

Case 2 Subject field - Hello <% =targetData.firstName %>

Thanks in advance for advice.
J-Serge

Answers (5)

Answers (5)

Jean-Serge_Biro

MVP

28-08-2017

Hi Sagi,

In your JS code as in mine, there is a flaw: if the subject fields contains JS customisation (if then else) or personalisation field, the result is not given correctly, it doesn't take into account the JS code, not interpreted, so the functions return all the labels included.

Actually, the CDATA taken is common to all messages, the delivery itself.

So it should be added 2nd pass JS interpretation, a bit as in Content Management (publication templates), in order that it would be evaluated for the accurate message for 1 contact.

I am looking for the exact syntax to do it either with your solution or mine (standard xpath object).


If someone else could help, it would be appreciated.

Regards
J-Serge

Jean-Serge_Biro

MVP

28-08-2017

Hi Sagi,

While working, your code is a bit risky, in case of Adobe Campaign Product team decides to change the XML memo field.

You should rather use this simple notation in your delivery:

<%= message.delivery.mailParameters.subject %>

Regards
J-Serge

sagil23995776

28-08-2017

Hi,

At the end I've managed to get the subject line into a variable by doing this:

instance.vars.subjLine = sqlGetString("select substring(dl.mdata,position('<subject><![CDATA[' in dl.mdata)+18,position(']]></subject>' in dl.mdata)-position('<subject><![CDATA[' in dl.mdata)-18 ) from nmsdelivery dl where sInternalName='DM12345'")

So now I can write it into a file.

Thanks,

Sagi

Amit_Kumar

MVP

28-08-2017

Sagi,

As Vipul mentioned, you can not export memo fields in CSV as they are stored in XML format.

You can only export database field like all primitive types, i.e., string, int, boolean, etc.

To export use a file export activity, Read this for instructions.

Exporting data

Regards,

Amit

Vapsy

Employee

28-08-2017

Hi Sagi,

You can export it as an XML file.

Subject is part of memo field of nms:delivery schema and exporting the entire memo field to CSV will not help.

Regards,
Vipul