Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Exporting XML Fields

sagil23995776
Level 3
Level 3

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

1 Accepted Solution
Jean-Serge_Biro
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

0 Replies
Vapsy
Employee
Employee

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

Amit_Kumar
Community Advisor
Community Advisor

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

sagil23995776
Level 3
Level 3

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

Jean-Serge_Biro
Community Advisor
Community Advisor

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

Jean-Serge_Biro
Community Advisor
Community Advisor

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
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post