Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Exporting XML Fields

Avatar

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

Avatar

Correct answer by
Level 10

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

6 Replies

Avatar

Employee Advisor

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

Avatar

Level 10

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

Avatar

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

Avatar

Level 10

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

Avatar

Level 10

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

Avatar

Correct answer by
Level 10

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