Input
- 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 All,
I have a scenario,
I want to except a file from user using a interface.
User should have a independent of file format.
Please consider the following image as example.
For e.g,
User can choose any file format in a single interface which we are asking from user.
Please suggest some workflows.
Thanks
- Labels:
- Datasets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @vijaylnyadav - the advice I received from Alteryx is that the best way to build a macro is to first build a workflow that works, then convert it to a macro. In the example below, I configured the input tool to read a file on my local machine. When you connect the interface tool the default configuration is to "Update Input Data Tool". That should be all that you need.
You can also limit the file selection to specific types in the File Browse tool:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@morr-co can you please build some workflow so that i can understand and implement it in my project as I am new to this tool
And as you mentioned I can limit the file selection to specify types can you explain this also with the help of workflow. It will be great help from your side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Are you looking to restrict the file type that a user input to the workflow? It looks like you're familiar with the File Browse tool from the interface category, so all that's left is customizing that tool and maybe adding a test afterwards.
File Browse Tool:
In the tool configuration, there's a setting to restrict the file type the user can select: The format of this string is a description and a RegEx-style match to the file name in this syntax:
<description>|*.<extension>
Here's what this might look like if you only want the user to input .yxdb files:
Alteryx Database (*.yxdb)|*.yxdb
Now that we're armed with this understanding, we can extend this functionality to specify more that just file extension. Any part of the file name can be specified here: For example: I want the user to only input .yxdb file with "NEW" in the name. We can use "Alteryx NEW Database (*NEW*.yxdb)|*NEW*.yxdb"
Example workflow attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@CharlieSconsider i want the user should upload the input files in .txt, .dat, .xlsx, .xls, or .csv files that depends on the user.
Now with the file type as mentioned above can you please suggest workflow it will be a great help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So all those file types are valid, but each type may only be valid for certain users? That suggests we need a way to identify the user and map the valid extensions to each user. That may be difficult depending on how the workflow is accessed by the users (Server? Shared Workflow? other?) and how many users/file combinations we're talking about here.
Maybe in a Server application, you can deploy different version of the workflow to each user. If it's a workflow on a shared drive, maybe environmental variables could help, but that could be as sketchy as just asking the user to enter in some identifying information and checking after the fact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@CharlieS I mean to say user can upload a file from one of the below file types in a single input which we are asking from the user by interface:
1. .csv
2. .xlsx
3. .xls
4. .txt
5. .dat
file types.
can we add all these file types specifications in a single file browse tool("Arbitrary File Specification")
So our workflow should accept all the 5 types of file type in a single input path without throwing an error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
So prompting the user to input one of those file types is the easy part, here's the string for the File Browse tool:
Comma Separated Values (*.csv)|*.csv|Microsoft Excel (*.xlsx)|*.xlsx|Microsoft Excel 1997-2003(*.xls)|*.xls|Text Files (*.txt)|*.txt|Data File (*.dat)|*.dat
The difficult part is the whole "accepting any of those file types and running without error". Tools like that can be very complex depending on the application. Here's a few thoughts:
- The biggest challenge here is Excel vs not Excel. The problem with the Excel files is that a sheet must be specified. It may be the case that the user-input file here will always have a sheet of consistent name and format. If so, the easy route would be to hardcore that sheet name to always be used when an Excel path is input. Which bring me to my second point.
- After the user inputs the file path, you'll need to handle Excel files differently (read: a different string of tools) and then union the two paths together when the input process is complete. This is because of how the sheet specification will be handled. Maybe it's a consistent name like I mentioned above, but if not you could read the list of sheet names and build an workflow to determine which one to use, or something else.
- One thing is clear in these situations, you're probably not going to be able to build something as simple as just connecting this File Browse tool to an Input tool. It will not be flexible enough to handle these different situations/files. I highly recommend that you build a batch macro that takes the user file path as an input (control parameter) and can configure itself to read any of the types listed above.