Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Batch Macro Detour if Condition is Met

hellyars
13 - Pulsar

I want to modify a workflow into a batch macro.  

The source XML files are structured almost exactly the same.   Except, some files have a Root Element of MasterJustificationBook (that contain JustificationBooks) while others have a Root Element of just JustificationBook (because it only contains one book).   The first parse tool is set to parse a Specific Child Element with the name Program.  The only difference is that the Field to Parse is set to MasterJustificationBook_OuterXML for one and JustficationBook_OuterXML for the other.  Everything following the initial parse is the same.  How can I combine these two workflows to account for this initial difference? 

 

I guess the question is:  How can I dynamically change the Filed to Parse to account for the presence or absences of Master in the field name?  Put another way, how can I structure the workflow to adapt to the presence or absence of Mater in the field name prior to the first parse?

 

On input there are 5 fields (columns)

 

JustificationBookxmlns:acTargetSchemaVersionJustificationBook_OuterXMLFileName
     

 

MasterJustificationBookxmlns:acTargetSchemaVersionMasterJustificationBook_OuterXMLFileName
     

 

 

Screen Shot 2021-01-18 at 4.13.34 PM.png

5 REPLIES 5
kelsey_kincaid
12 - Quasar

@hellyars ,

Could you use a Dynamic Rename to conditionally rename the MasterJustificationBook_OuterXML field to JustificationBook_OuterXML as shown below? Let me know if I'm misunderstanding the issue.

 

 

2021-01-18_15-52-07.png

hellyars
13 - Pulsar

@kelsey_kincaid   Wow.  That was wicked simple.  I thought changing the name would mess up reading the XML.  It had zero impact.   Again, Mondays!

kelsey_kincaid
12 - Quasar

@hellyars I'm glad it worked!

hellyars
13 - Pulsar

@kelsey_kincaid   I have a quick follow up question.  I took your approach and tried to add 2 replace expressions with an OR statement.   

 

 

Replace([_CurrentField_],"JustificationBook","RootElement") OR
Replace([_CurrentField_],"MasterJustificationBook","RootElement")

 

 

It did not error out.  But, it renamed the columns 0, 0_2, -1, 0_3, and 0_4

 

 

kelsey_kincaid
12 - Quasar

@hellyars ,

Try this:

 

 

Replace(
Replace([_CurrentField_],"MasterJustificationBook","RootElement"),
"JustificationBook","RootElement")

 

 

Labels