MULTIPLE XML TAGS IN ONE EMAIL

Post Reply
boxclever
Newbie
Posts: 13
Joined: Thu Aug 11, 2016 11:03 am
Location: France

MULTIPLE XML TAGS IN ONE EMAIL

Post by boxclever »

Hello to all.
Hope everyone is doing well.

At the end of a flow, I have a folder with a number of XML files inside. Each xml file is structured in the same way and simply has a different file name. All I am after is sending ONE email with a resumé of the number of xml files and a short description from elements within.

I can use metadata>text>build location path with an external metadata dataset and I can see – one at a time – the data tree for each xml file.

By using [Job.FileCount] and [Job.NestedName:Prefix="<li>",Suffix="</li>",Segment="7-99"] I can get a list of each xml file name into one single email. The email body text is “multi-line text with variables defined”. So, inside the email, I end up with
  • We have received 2 files:
    • 19_MONACO_1000_3.xml
    • 32_MONACO_2000_27.xml
Where…
19 = Order N°
1000 = Ticket variety
3 = number of tickets

What I can’t seem to fathom is how to get several parts from inside each xml file into the same email. Basically, I would like to obtain:
  • There are 3 tickets to print on the model 1000 for Monaco (where "3" and "1000" are the variables)
    There are 27 tickets to print on the model 2000 for Monaco (where "27" and "2000" are also the variables
I only ever end up with the first occurrence from the first xml file of the parts that I want.
Each xml looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<ETIQUETTE>
<Lieu>MONACO</Lieu>
<LieuInt>C2</LieuInt>
<Lib>PEINTURE</Lib>
<Article>TOLLENS BLANC 50L</Article>
<Date>2022-01-21</Date>
<EtiquetteNo>1000</EtiquetteNo>
<PrixOrig>100.00</PrixOrig>
<PrixNouv>50.00</PrixNouv>
<Remise>50</Remise>
<GenCode>123456</GenCode>
<NoEx>3</NoEx>
</ETIQUETTE>

I’ve tried a variety of things with some try for free apps from the store (Create Log; Inject XML; Meta Tagger; Take Notes)
I’ve been pointing to [Metadata.Text:Path="/ETIQUETTE/NoEx",Dataset="Xml",Model="XML"] but no matter how many xml files I have I only ever get one result.
If anyone has a pointer I would be more than happy to learn.
Thankyou
Sean
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: MULTIPLE XML TAGS IN ONE EMAIL

Post by freddyp »

A custom script would of course solve this.

Conceptually the solution is to combine all the XML files into one and in your mail you can then use the method you are already using to place the info. Merging all the XML files means creating a new root node (an XML is only valid if it has a single root node) and appending the contents of all the XML files in the input folder WITHOUT the XML declaration line.

With XSLT2.0 merging XML's is possible but difficult to do. Well, difficult for me. I tried once and abandoned the effort.

I am pretty sure it is possible to create a batch file/shell script that does this type of concatenation using sed or awk, but I do to have enough experience with it to do this in a couple of minutes.

The Make XML app has a feature to insert the content of a dataset file into an XML file that is being constructed. You need something similar but not inserting a dataset, but inserting the input job and more specifically all the XMLs in the input job. Perhaps the app creator is willing to extend the functionality and foresee this functionality?
boxclever
Newbie
Posts: 13
Joined: Thu Aug 11, 2016 11:03 am
Location: France

Re: MULTIPLE XML TAGS IN ONE EMAIL

Post by boxclever »

Freddy
Thank you for the imput. I've asked that we purchase the scripting module as that would appear to be the best solution. Reading through a number of older posts I can see that I'm not the first to have difficulty for this particular need with the standard tools available. Some people have managed it through "textindexed" but none of my files can select that. I tried to cheat and just wrote "<ol><li>[Metadata.TextIndexed:Path=......,Separator="</li><li>"]</li></ol>" but that didn't work either. I come more from a Prinergy RBA background and I thought that what I was after was the sort of "bread and butter" type of thing to Switch without having to script but there you go. Thanks again for the reply.
Sean
Post Reply