Start Free Trial

Alteryx Designer Desktop Discussions

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

Output data if there is one if blank then output headers

aparna0208
8 - Asteroid

Hi,

 

I have a workflow that outputs multiple tabs into an excel. There is one particular tab where sometimes you won't have any data and sometimes there is data. Wanted to see if there is a way to write the data if there is one and if it's blank then just output the headers.

 

Example:

If the workflow output contains data then

 

Branch       Customer ID           Segment

BR123        23244                      NU

 

If workflow output contains no data then

 

Branch        Customer ID             Segment

 

 

 

13 REPLIES 13
Emil_Kos
17 - Castor
17 - Castor

Hi @aparna0208,

 

Please check my solution.

 

Emil_Kos_0-1641493912026.png

 

What I have done is use the count records tool to create at least one line of the text. The workflow should output just headers if that situation will show up. 

 

ArtApa
Alteryx
Alteryx

Hi @aparna0208 - In Alteryx almost everything can be done in a couple of different ways. My approach is to push headers down as the first row of data and configure the output data tool to skip field names. You can Union by position with your data and you will not need to perform any checks.

 

ArtApa_0-1641513910345.png

 

aparna0208
8 - Asteroid

@Emil_Kos Thanks for your inputs. I tried this but still not getting the expected output(blank headers)

aparna0208
8 - Asteroid

@ArtApa This actually works when I configure output data tool to skip field names. The problem is I have multiple tabs writing to an excel and this is just one tab so I don't think I'll be able to configure the output tool as it would impact other tabs.

atcodedog05
22 - Nova
22 - Nova

Hi @aparna0208 

 

Here is a modification of @Emil_Kos workflow which will work. Let me know if you face any issues.

 

Workflow:

atcodedog05_0-1641577747450.png

 

Hope this helps : )

 

atcodedog05
22 - Nova
22 - Nova

Hi @aparna0208 

 

I got a better understanding now. You want to write to multiple tab with a single output tool. Below is how you can do it.

 

Workflow:

atcodedog05_0-1641578143092.png

 

Hope this helps : )

 

aparna0208
8 - Asteroid

Thank you @atcodedog05 The problem is in the formula tool. IF condition with [Branch   ] format throws error stating Branch is unknown variable. When I give space after branch I get this error

atcodedog05
22 - Nova
22 - Nova

Hi @aparna0208 

 

You would just need to rename the variable in the formula to the actual column name. If column name is "Branch" then use [Branch] in formula tool.

 

Hope this helps : )

aparna0208
8 - Asteroid

@atcodedog05 Perfect this worked! I just wanted to know if there is a way to tweak this so that if there is any data then write that to the excel if not output blank headers

Labels
Top Solution Authors