Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Batch macro help - missing sheet

cireost
8 - Asteroid

Hi - I created a simple example of batch macro to illustrate my issue.  I have three excel files (Property A, B, C) and within each file, there are several tabs (Summary, Expiration, Rent).  All the workflow is doing is pulling data from each of the tabs.    However, Property C does not have a "Rent" tab.  As such, the batch macro fails.  In my real life example, I cannot predict if a given tab will be present in an excel file.  If it is not present, I would like the results to be null for that tab.  I have attached 2 examples below.  The CLEAN example is assuming all tabs are present.  The HELP example is if the tab is missing.   Any help would be greatly appreciated.

7 REPLIES 7
MichalM
Alteryx Alumni (Retired)

@cireost 

 

You can change this behaviour by opening Interface Designer (View > Interface Designer) and navigating to Properties of the macro. Make sure that the Output mode is set to 'Auto Configure by Name'.

 

macro-properties.png

cireost
8 - Asteroid

i just tried and think i am still having this issue.  any chance you could edit the workflow for me?

MichalM
Alteryx Alumni (Retired)

My bad - I jumped the gun here. Any chance you could share the files with me so I can have a look at the structure? 

cireost
8 - Asteroid

I thought when i exported the workflow that it would include the input files.  but here you go!

 

You'll notice that Property C does not have a "Rent" rab.

 

Thanks!

MichalM
Alteryx Alumni (Retired)

There are couple of things that need addressing on top of the change I already suggested - change the Output mode in the macro properties to 'Auto Configure by Name'. Then

 

1. We need to make sure that if there's no 'Rent' sheet, the Input Data which expects it is disabled. This can be achieved by adding it to a container and disabling that container if the string coming in is empty

 

disable-container.png

 

 

2. And also that the last Append Fields is skipped unless there's data. This can be achieved by leveraging Detour -  the workflow will go Left if there's no 'Rent' sheet and Right if it's there

 

detour.png

 

 

Attached is the updated macro. 

cireost
8 - Asteroid

Thanks! I am taking a look now. Did you have to make changes to this workflow?  This was the workflow built to allow users to read from a directory where each of the property excel files are located.

 

image.png

MichalM
Alteryx Alumni (Retired)
No. I've only changed the second macro.
Labels