Hi All,
I'm looking at taking the XML nodes (items ordered) and sending a email listing the items order.
How do I get the repeating XML data into an email.
Thanks for any help
multiple XML nodes in email alert
Re: multiple XML nodes in email alert
Hi All,
I'm still struggling with this. I can place metadata node based on:
/item[1]/value
/item[2]/value
etc
but i want to extract all items ie /item[???] and then list in an email
Is it possible??
Thanks for any help
I'm still struggling with this. I can place metadata node based on:
/item[1]/value
/item[2]/value
etc
but i want to extract all items ie /item[???] and then list in an email
Is it possible??
Thanks for any help
Re: multiple XML nodes in email alert
I heavily rely on PrivateData in my flows so I would create script and write every node that exist into a PrivateData key.
I do something similar over here:
With this I have OrderRow01-OrderRow20 in PrivateData. When no node is found the key simply doesn't exist.
Edit: And with this logic and with the magic of e.g. a script expression you can create a nice mail
Hope it helps,
I do something similar over here:
Code: Select all
// OrderRowNumber, OrderRows, OrderRowsTotal is taken from a different query.
// Column1: OrderRowNumber
// Column2: OrderRow
// Column3: Bestand
for (i = 1; i < 21; i++) {
// OrderRow
var string = job.getVariableAsString("[Metadata.Text:Path=\"//Row["+i+"]/Column[2]\",Dataset=\"OrderRow\",Model=\"XML\"]");
if (string != null) { if (string.toLowerCase() == 'undefined') { string = '' ; }
job.setPrivateData('OrderRow'+i,string);
job.setPrivateData('OrderRowsTotal',i); // Haha!
}
Edit: And with this logic and with the magic of e.g. a script expression you can create a nice mail

Hope it helps,
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter
Re: multiple XML nodes in email alert
Hi, Thanks for that it helps a lot.
Are you able to multiple privatedata in one hit ie instead of OrderRow01, OrderRow02, OrderRow03 by using a wildcard and a separator ie OrderRow[*] & ,
Are you able to multiple privatedata in one hit ie instead of OrderRow01, OrderRow02, OrderRow03 by using a wildcard and a separator ie OrderRow[*] & ,
Re: multiple XML nodes in email alert
Instead of putting everything in different pieces of private data, just put everything into one string and put the separator that you need inside the string. For use in the To or CC fields that would be a semicolon, for use in lines in an HTML mail that would be <br>, ...
Codewise (not tested)
Codewise (not tested)
Code: Select all
var mails ="";
var itemValues = xmlStructureVariable.evalToNodes("//item[*]/value");
for (var i=0; i<itemValues.length; i++) {
mails = mails+itemValues.at(i).getFirstChild().getValue()+"<br>";
}
job.setPrivateDate("Mails",mails);
Re: multiple XML nodes in email alert
Thanks Freddy!
I'm using your example for another case to push all files I gather from a xml into a flow. In this case, I do have a number of unknown nodes so your example is perfect.
Thanks,
I'm using your example for another case to push all files I gather from a xml into a flow. In this case, I do have a number of unknown nodes so your example is perfect.
Thanks,
Part of my playground:
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter
- HP Indigo 10k, HP Indigo 7600's (full options), Highcon Euclid III, Zünd S3
- HP Production Pro 6.0.1, HP Production Center 2.5.1 beta, Apogee 9.1, Enfocus Switch 13u1 & PitStop Server 13u2.
Chat: open-automation @ gitter