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

Dynamic Input Error

lmosher
6 - Meteoroid

Hi, 

 

I am using the Dynamic Input tool to read multiple CSV files into my workflow; however, there are some files that create an error due to "a field was missing a closing quote in record...". Once that error occurs, it stops reading any further CSV files. 

 

I'm wondering, is it possible to change the settings so that it ignores that error and continues to read the remaining lines of the CSV file, along with any other CSV files that come after it?

 

Thanks in advance!!

 

6 REPLIES 6
Thableaus
17 - Castor
17 - Castor

Hi @lmosher 

 

I think that would be the case you should use a Batch Macro to read these files. 

 

In the Batch Macro you can actually give a special treatment to each of these cases of corrupted schema - you could even set something to skip these files.

There are some articles that explain this method

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Batch-Macro-Output-into-Multiple-Files...

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Import-Multiple-Excel-Sheets...

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Read-in-Multiple-Excel-Files-with-M...

 

Cheers,

lmosher
6 - Meteoroid

Hi @Thableaus

 

Thanks for your prompt response!

 

Here's what I've got so far per your suggestion. I've never used the Batch Macros before, so I'm not entirely sure how to progress from here. 

 

One of the links you posted talked about changing the names of the input; my issue deals with a single line in the CSV file that doesn't have a closing quotation. How do you go about setting the macro to skip the lines in the file with the corrupted schema?

 

lmosher_0-1573835473213.png

Thableaus
17 - Castor
17 - Castor

@lmosher 

 

In this case you don't use the Dynamic Input.

 

The macro needs to be built separately from where you're going to insert the File Paths (from the Directory Tool).

 

I will get you an example later, but if you carefully read the articles I posted, you will figure this out.

 

Cheers,

darryl5280
10 - Fireball

Using the "Text to Columns" tool is a lot more flexible than the "Input" tool, and then you can filter out the bad data and try to fix it.

 

Double Read the CSV file.jpg

In the "Input" tool you set the delimiter to "\0" for no delimiter, and in the "Text to Columns" tool you put in your real delimiter.

 

The "Input" tools configuration window:

Read in with no Delminter.jpg

 

The "Text to Columns" tools configuration window:

Text to Columns Tool.jpg

lmosher
6 - Meteoroid

@darryl5280 this works perfectly! Thanks for the solution!!

BlaseG
8 - Asteroid

On the options where it says " Ignore delimiters in", I changed this from "Quotes" to "None", and that seemed to fix this error as well.  

Labels