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)
JustificationBook | xmlns:ac | TargetSchemaVersion | JustificationBook_OuterXML | FileName |
MasterJustificationBook | xmlns:ac | TargetSchemaVersion | MasterJustificationBook_OuterXML | FileName |
Solved! Go to Solution.
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.
@kelsey_kincaid Wow. That was wicked simple. I thought changing the name would mess up reading the XML. It had zero impact. Again, Mondays!
@hellyars I'm glad it worked!
@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
Try this:
Replace(
Replace([_CurrentField_],"MasterJustificationBook","RootElement"),
"JustificationBook","RootElement")