Hello Alteryx users, here's a interesting use-case and a automated solution for it..!
- Hope you are aware of custom tool installation, if not -> https://help.alteryx.com/developer-help/yxi-packaging-and-installation
- In Designer, you might have came across sample workflows for each tools which can be accessed by clicking the "Open Example" present in each tool.
Now the use-case is to merge these 2 steps.
When we install a .yxi file all the files will be installed at "C:/Users/%USERNAME%/AppData/Roaming/Alteryx/Tools". There's no way to customize this to install a file in certain custom location.
Similarly, all sample workflows that are referred using "Open Example" under the tools should be placed only at "%ALTERYX_INSTALL%/Alteryx/Samples/%LANG%" as referred in the article -> https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-to-add-an-example-link-in-the-c...
So the only possibly seeming way is to send the sample workflow separately to the user and manually perform the following configuration steps in the user system.
Files used in this demo :
Installer file -> Skip_last_N_records.yxi
Inside the .yxi file :
Sample Workflow -> Sample_skip_last_n_records.yxmd,
Setup file -> Setup.yxmc,
Primary macro file ->Skip_last_N_records.yxmc
STEPS:
1. Put the sample workflow inside a folder (For e.g. Skip_last_N_records) and placing that at the path "%ALTERYX_INSTALL%/Alteryx/Samples/%LANG%".
2. Then the following part of the Macro file (C:/Users/%USERNAME%/AppData/Roaming/Alteryx/Tools/Skip_last_N_records/Skip_last_N_records.yxmc) needs to be configured. Try opening the macro with some text editor like Notepad.
3. By default the "Description" and "File" tag are left empty as shown above.
4. Configure that as shown below, and replace the %USERNAME% with your logged username.
5. Now we need to configure the sample workflow to refer to the Macro which is just installed at the path "C:/Users/%USERNAME%/AppData/Roaming/Alteryx/Tools"
6. To do this open the sample workflow("%ALTERYX_INSTALL%/Alteryx/Samples/%LANG%/Skip_last_N_records/Sample_skip_last_n_records.yxmd") file in text editor and navigate to the tag,
7. This has to be replaced as,
-> On successful completion of all these changes, after restarting the Designer the sample workflow can be accessible under our macro with the text "Open example".
-> It's pretty clear that it's a tedious process and needs certain time to configure these manually, and that too in a user's system. Generally, manual configurations needed to be avoided to make the application look more user-friendly.
-> Now what if we automate this process..!?
-> Yeah, with a single setup macro with a "Python" tool can serve you this. Python is a extremely powerful tool and this use-case solution is a sample of it.
-> The setup macro needs to be executed just once after installation, and if we restart the Designer, BOOM! you will get all the required configurations taken place and sample workflows will be accessible.
-> The setup macro is also embedded within the installer file itself, so it will be available in the tool palette post the installation.
-> The required files are attached below.