Resolve File Type
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Team,
I have two flat files by name A.txt & B.txt.
I configured file A.txt file in input tool with file type selected flat file.
But when im changing my filename manually from A.txt to B.txt, window pop up appears saying resolve file type.
My requirement is file type should be auto-selected by default when im entering filename in input data configuration.
Eg - if filename is A.txt and im manually changing filename A.txt to B.txt- filetype should read Flat File by default.
Solved! Go to Solution.
- Labels:
- Input
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
After you change the file name, when the window pop up appears, if you click the Cancel button:
- the Input tool will use the new file name
- the rest of the prior configuration will remain the same
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi ChrisTX,
Thnx for alternate solution.
But since i will be using macro file every time, i don't want every time window pop up to appear and click on cancel manually.
Is there any solution where window pop up does not appear and file format by default detect file type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you provide some more detail on your workflow and macro? Or post both?
I'm not understanding "since i will be using macro file every time".
I'm thinking you might want to use a Directory tool with Dynamic input? Just guessing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Chris,
Im attaching my flat file and workflow. pls check and help the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What is happening that you need to fix? When does it happen? When you run the workflow? When you do "something" manually?
I'm guessing this may be the problem: in your workflow, in your Text Input tool, you have field "FullpathforExcel". But the value in that field is a TXT file. Should be an Excel file.
To post your full workflow here, including macros and files, use the Alteryx menu option for Options > Export workflow, which will create a YXZP file for you to post.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi ChrisTX,
When im changing my (TXT) filename manually in input text tool. windows pop is appearing saying resolve file type.
I have to manually then select ASCI flat file in built in type.
I want a solution where file should automatically detect txt file and no window pop should appear.
I hope this may help you to understand the requirement.
attaching snapshot for your ref.
Data / workflow, I have already shared with you. you can create new workflow as well to fix this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @suraj46nair ,
Flat file in Alteryx is not a data file, but a data format definition (described in XML format).
See alteryx help: https://help.alteryx.com/current/en/designer/file-types-support/flat--ascii--files.html
At Input Data Tool, when you select A.TXT file, select "Read it as a fixed width text file".
Then you can define the fields with length and type as below.
After you define the fields, you can "export" the definition.
You can save it to ".flat" file.
As the flat file is described in xml, you can open it with editor as below.
<flatfile version="1">
<file eoltype="lf" allowShortLines="t" allowLongLines="f" trimWhiteSpace="t" />
<fields>
<field name="Field_1" type="Int32" length="5" />
<field name="Field_2" type="V_String" length="10" />
<field name="Field_3" type="V_String" length="6" />
<field name="Field_4" type="V_String" length="9" />
<field name="Field_5" type="V_String" length="330" />
</fields>
</flatfile>
To use it to open a file, you need to add "path" attribute to <file> tag as below.
<flatfile version="1">
<file path=".\b.txt" eoltype="lf" allowShortLines="t" allowLongLines="f" trimWhiteSpace="t" />
<fields>
<field name="Field_1" type="Int32" length="5" />
<field name="Field_2" type="V_String" length="10" />
<field name="Field_3" type="V_String" length="6" />
<field name="Field_4" type="V_String" length="9" />
<field name="Field_5" type="V_String" length="330" />
</fields>
</flatfile>
Now you can read the .flat file with Input Data Tool.
The output would be B.TXT with the same format you defined earlier.
I hope this answered to your question.
Good luck.
