Conditional Node XML Decision

Questions and answers on how to get the most out of FFAStrans
Post Reply
graham728
Posts: 76
Joined: Sat Oct 13, 2018 10:54 pm

Conditional Node XML Decision

Post by graham728 »

Hi,

Looking for a way to use the Conditional node to change the course of a workflow based on metadata in the XML it has just read.

The %s_xml_advertiser% field will either start with the characters CP or CB - I'm unsure what to put in the right-hand field for the node to either accept or reject and thus change the path the file is then sent down.
User avatar
FranceBB
Posts: 231
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: Conditional Node XML Decision

Post by FranceBB »

So if it starts with CP or CB is fine?

Step 1:
Read the XML

Image

Code: Select all

%s_myxmlfile% = $read("%s_original_path%\%s_original_name%.xml")
Step 2:
Read the advertiser value and save it in your variable "xml_advertiser"

Image

Code: Select all

%s_xml_advertiser% = $stripws($between("%s_myxmlfile%", "<Advertiser>", "</Advertiser>"))
Step 3:
Check if it starts with CP or CB

Image

Code: Select all

if %s_xml_advertiser% == CP* || if %s_xml_advertiser% == CP* Then
do something
else 
do something else
The whole workflow would be something like:

Image
momocampo
Posts: 592
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Conditional Node XML Decision

Post by momocampo »

Hi ,

Here is my method, I prefer to use regex to retrieve what you want.


advertiser.jpg
advertiser.jpg (75.24 KiB) Viewed 1654 times

Your variable %s_xml_advertiser% will be "CP" or "CB", just place a conditonal after the previous populate node

cond.jpg
cond.jpg (46.97 KiB) Viewed 1654 times

So, if "yes" -> CP
If "no" -> CB

Hope it helps.
B.
Post Reply