Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Output field names even if record count = 0

poles1c
8 - Asteroid

Hi,

 

I am reading in a fixed width file that has header,detail record, and trailer components,I ultimately want to write these to HDFS. If the detail record component has 0 records there will be no output for the associated Alteryx field names. I need to output all fields even if there aren't detail records in the fixed width file. Anyone have a clue how I might go about this?

 

Thanks!

 

Courtney

3 REPLIES 3
RodL
Alteryx Alumni (Retired)

Can find a specific example, but (from memory) one technique I've seen is to create a Text Input tool with a single record of NULL values in the fields.

You can then Union that with the existing workflow (which will then provide at least one row of data). You of course then don't want that record in your data if you actually do have data, but again from memory, if you order the Union to first take the "real" data and then union the "fake" record data, you can test in a to see if the first record has NULLs and if not, then filter out all NULL records (which would be the one at the bottom out of the Union).

Sorry it's not more exact, but thought I'd at least throw this out as something you could try. :-)

poles1c
8 - Asteroid

Rod your idea worked! I paired it with a record count tool and I am good to go. Thanks!

Raghu_s
8 - Asteroid

Thanks @RodL. Jsut curious what if I have automated workflows and I have the intermediate outputs as YXDB files, do we have an option inbuilt to allow the file to be generated even if there are no records out? At times I had to revisit few workflows to change the existing setup and revert back when this scenarios doesn't happen. 

 

A simple checkbox to allow just the headers with null data would a great add on. what do you think? 

Labels
Top Solution Authors