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.

Alteryx Designer Desktop Discussions

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

Wildcard only read first file

largychen
6 - Meteoroid

Hi everyone,

 

I have 8 CSV files with same schema in the same folder. When I try to run wildcard on them, it only read one file and the warning goes "Record #2 not enough fields".

 

Then, I changed delimiters to "\n", but this time it still read one file but the warning is gone. I am confused. Thanks for help.

15 REPLIES 15
largychen
6 - Meteoroid

Hey Dan

Here is the file and screenshot. 

 

largychen_1-1683295768294.png

 

 

danilang
19 - Altair
19 - Altair

hi @largychen 

 

Neither of the files that you've attached is actually a csv file. These are text files with a .csv extension.   A well formatted csv file has exactly one line of field definitions followed by a series of data lines as in 

 

ID,Name,Salary

1,"Jane Doe",20000

2,"Matt Smith",10000   

 

Your files have a header in red followed by the actual data in green 

danilang_0-1683297852123.png

 

If you start your input on line 6, the files should be read without error.

 

Dan

 

 

largychen
6 - Meteoroid

Hey Dan, Thank you. I have actually two inputs one starting in line 1 and the other starting in line 6.

largychen_0-1683298430487.png

 

The reason why I still need line 1 is that I need that info in my output sheet. The only thing I need is Row 1&2 in below

 

largychen_1-1683298455723.png

 

danilang
19 - Altair
19 - Altair

hi @largychen 

 

In that case, set record limit = 2 in your second input tool to only read rows 1&2 and avoid the errors that caused by field differences in row 3.

 

Dan

largychen
6 - Meteoroid

Sorry Dan, record limit = 2 doesn't work I got the same messages. Only record limit =1 will work without warning and error, but the issue is record limit seems not working with wildcard. I want row 2 in all file stack together like this below.

 

Input Data (223) Record #2: Not enough fields in record.
Input Data (223) Error reading "C:\Users\XXX\Cambium22_MidCase_hourly_p1_2024.csv": Too many fields in record #3

 

Ideal output

 

largychen_1-1683302402473.png

 

 

danilang
19 - Altair
19 - Altair

hi @largychen 

 

This seems to work for the 2 files that you posted

danilang_0-1683304353609.png

 

Read all the lines with \n as the delimiter and 1st row as a data row.  Take the 1st two rows from each file.  Then take the 1st row and parse the header fields using text to columns.  On the bottom skip the first row from each file and parse the data fields.  Union and use a Dynamic Rename to moved the 1st row to the headers

 

danilang_1-1683304599342.png

Dan

 

 

Labels