Alteryx Designer Desktop Discussions

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

How to Configure the Input tool to Import the data from .flat file

stj1120
8 - Asteroid

Hi all,

 

I have a text file with the extension '.flat'.  I tried multiple ways in configuring the Input tool. But, no luck. All the time, I'm getting an error as the  "Missing root element 'flatfile' "

 

I;m unable to attach the  .flat file here as it is not allowing me to attach. Can anyone please help in configuring the Input toool to import the data from .flat file. 

 .

sreenivasateja_0-1587137632246.png

 

Awaiting your responses.

 

Thank you.

 

Br,

Sreenivasa Teja.

 

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

I would load it as a CSV with delimiter set to \0

stj1120
8 - Asteroid

Hi @DavidP

 

Thank you for your response.

 

Is there any alternate solution where we can use .flat  file and import the data in Alteryx? 

 

Kindly let me know. Many thanks!

 

Br,

Sreenivasa Teja.

DavidP
17 - Castor
17 - Castor

Have a look at this link for an explanation of flat files https://help.alteryx.com/current/designer/flat-ascii-files

 

The flat file is an xml file that describes the structure of another data file, typically a .asc file. Below is an example of the flat file that I created in Alteryx. 

 

I'd suggest opening your flat file in a text editor to see if you can spot a problem or to make sure that the path to the data file is correct. 

 

Alternatively, as the suggested in the flat file documentation above, you can open the data file directly as an unknown filetype with  "Read it as a fixed width text file option" and then specify the file layout.

 

It's difficult to give more guidance without actually knowing what the problem with your files are. Perhaps you can zip the files up and try to attach the zip.

 

<flatfile version="1">
<file
path="C:\Users\david\Desktop\testfile.asc"
eoltype="crlf"
/>
<fields>
<field name="Order ID" type="V_WString" length="255"/>
<field name="Order Date" type="Date" length="10"/>
<field name="Customer ID" type="V_WString" length="255"/>
<field name="Customer Name" type="V_WString" length="255"/>
<field name="Segment" type="V_WString" length="255"/>
<field name="City" type="V_WString" length="255"/>
<field name="State" type="V_WString" length="255"/>
<field name="Country" type="V_WString" length="255"/>
<field name="Region" type="V_WString" length="255"/>
<field name="Product ID" type="V_WString" length="255"/>
<field name="Category" type="V_WString" length="255"/>
<field name="Sub-Category" type="V_WString" length="255"/>
<field name="Product Name" type="V_WString" length="255"/>
<field name="Sales" type="Double" length="19"/>
<field name="Quantity" type="Double" length="19"/>
<field name="UnitCost" type="Double" length="19"/>
<field name="Total Cost" type="Double" length="19"/>
<field name="Profit" type="Double" length="19"/>
<field name="Ship Date" type="Date" length="10"/>
<field name="Ship Mode" type="V_WString" length="255"/>
</fields>
</flatfile>

atcodedog05
22 - Nova
22 - Nova

Hi @stj1120,

 

I was able to recreate the error.

atcodedog05_0-1587199101804.png

 

The expected .flat file format.

atcodedog05_1-1587199157914.png

 

You get error when it doesnt start with a <flatfile version="1"> which is the root element of XML file. Like below.

atcodedog05_3-1587199255654.png

 

Hence you might want to check the .flat file for the structure. Should start with <flatfile version="1">.

Below is a simulation snapshot of both scenarios.

 

atcodedog05_4-1587199378053.png

 

Hope that solves your problem.

 

If not please share your files over zip or drive so that we can better help you.

 

Thank you for sharing this scenario. It was a great learning.

Happy Analyzing : )

 

Labels