Start Free Trial

Alteryx Designer Desktop Discussions

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

Inputs from multiple alteryx workflows

Haarith
5 - Atom

I want to look into a folder with all of my Alteryx workflows and detail all of the input dependencies within those workflows.

6 REPLIES 6
Chaoued
8 - Asteroid

Alteryx workflows are stored as XML files (.yxmd, .yxmc, .yxwz). Each tool and its configuration is represented in XML tags. Input tools typically have tags like:

 

Exemple :
<GuiSettings>
<File>path_to_file.xlsx</File>
</GuiSettings>


So the steps are:

1. Scan the folder for all .yxmd, .yxmc, .yxwz files.

2.Parse each XML file and look for:

- <File> tags (Excel, CSV, etc.)
- Database connection strings (often in <Connection> or <Password> tags)
- Other input sources (API endpoints, etc.)


3. Aggregate results into a report (CSV or Excel) with:

- Workflow name
- Full path
- Input type (File, Database, etc.)
- Input location/path

Chaoued
8 - Asteroid

You can read your Alteryx workflow with Alteryx as a text file (CSV without the delimiter '\0'), then filter on the tags you want to extract.

caltang
17 - Castor
17 - Castor

You can use a Directory tool to read all your XML files via this tool: https://help.alteryx.com/current/en/designer/tools/parse/workflow-xml-parser-tool.html 

 

Save the workflows in a separate folder and convert them from .yxmd (or .yxmc/.yxwz) to xml files via cmd, then use a Directory tool to call in, batch the process with the tool above. Then parse what you need from there with keywords like "Input" etc.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Chaoued
8 - Asteroid

@caltang Hello,your response was very constructive. I would like to know which CMD command can be used to convert an Alteryx workflow into an XML file

caltang
17 - Castor
17 - Castor

Actually, now that I think about it, it gets too slow with command line. Python would be better.

 

import pandas as pd
import os

# Read the data coming from the upstream Directory tool (connected to the '1' anchor)
# The data arrives as a pandas DataFrame.
df = Alteryx.read("#1")

# Define the output directory where you want the .txt files saved.
# Make sure this path exists on your system.
output_dir = r"C:\Your\Output\Folder\Path" # !! Update this path !!

# Ensure the output directory exists
if not os.path.exists(output_dir):
    os.makedirs(output_dir)

processed_files_list = []

# Iterate through each row in the DataFrame (each row is one file found by the Directory tool)
for index, row in df.iterrows():
    # 'FullPath' is a standard column from the Directory tool
    source_path = row['FullPath']
    
    # Create the new filename with a .txt extension
    # 'FileName' is another standard column from the Directory tool
    new_filename = os.path.splitext(row['FileName'])[0] + ".txt"
    destination_path = os.path.join(output_dir, new_filename)
    
    try:
        # Read the content of the .yxmd file (it's just text/XML)
        with open(source_path, 'r', encoding='utf-8') as f:
            content = f.read()
        
        # Write the content to a new .txt file
        with open(destination_path, 'w', encoding='utf-8') as f:
            f.write(content)
            
        processed_files_list.append({'OriginalPath': source_path, 'NewTxtPath': destination_path, 'Status': 'Success'})
        
    except Exception as e:
        processed_files_list.append({'OriginalPath': source_path, 'NewTxtPath': 'N/A', 'Status': f'Error: {e}'})

# Create an output DataFrame to pass results back to the Alteryx workflow (optional)
output_df = pd.DataFrame(processed_files_list)

# Write the output DataFrame to the second anchor (named '2' by default)
Alteryx.write(output_df, "#2")

 

You can have the code above. 

image.png

 

I tested it with a dummy workflow provided by someone in the community and it generates from .yxmd to .txt (but structured as .xml):

 

image.png

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Chaoued
8 - Asteroid

@caltang That's so great, thank you so much

Labels
Top Solution Authors