Hello:
I have a simple workflow connected to a batch macro. Intent is to read 50 rows from a csv file which contains 2 columns. Col1 is the text which represents the file name to be saved. Col2 is the query syntax to be run on ms sql server.
main workflow looks like this:
So 2 lines are being fed to the macro, one for file name to be save other query syntax.
Here is the Batch Macro:
We start with macro input, what has dummy file name and SQL syntax. Top line is the TEXT which file name to be saved, and the bottom is SQL syntax, which feeds into Dynamic Input tool controlled by parameter by Action Tool.
Dynamic Input has a connection to ms sql server and SQL Editor contains the dummy query, which is valid. 'Modify SQL Query' button in Dynmic Input is selected and Action Tool is set to 'Update Value'
Main Issue: Main workflow appears to be reading all 50 rows, but macro is processing only dummy SQL syntax listed in macro input
Any point will be most appreciated. This work is working saving the file but only the dummy values specified in the macro input tool. 50 values from data input tool are not being passed to process them.
Thank you so much.
This is a hard one to test due to the DB Connection etc.
A couple of things:
The dynamic Input tool allows you to take a field and use that as the query.
The Batch Macro would be required in order to write to each individual file (Iterative Macro would work as well), as the Dynamic Input results would have different schemas.
In Summary, you've worked too hard.
You need the macro to process one query at a time, however that query should be passed in to the Dynamic Input as a field, not necessarily the Control Parameter acting on the Dynamic Input.
Theoretically, you can just have the list pumped in to the macro, into a dynamic Input. And use the control Parameter to group the data going in. So, use the group by parameter for the other input (Input44 on your example) on the outside of the macro (on the interface in your main workflow). If you still need to select it inside the macro, use the control parameter on a filter to select the correct record and then have that in to the Dynamic Input, with the query field selected as the replacement Field as you have already.
I haven’t had a chance to dig in but from reading the requirements, is a macro even needed? The schema issue will be an issue regardless unless you change the template script. So, couldn’t the workflow feed the dynamic input tool with the scripts and filenames, then append a field after that is the filename for each script, then use the output data tool’s ability to group outputs into different files?
This process appears to be over complicated based on the abilities available. Could be totally wrong though!
Bacon
batch macro:
text input. dynaminc input in-db. datastream out. output data.
control parameter 1 to action tool to text input.
control parameter 2 to action tool 2 to output data.
outer workflow ---> send in column of query (to control parameter 1), column of output filename (to control parameter 2)
Done.
Your sarcasm noted. I am new to Alteryx. A simple suggestion is appreciated. My 2nd week of using this App.
Thank you.
I am rand new to this app and thank you for your response. Pardon me, but I don't quite get it what you are proposing.
Follow my exact instructions. Use the tools that I specified. You are trying to build a fairly complicate macro. You will need to dive into Alteryx to get this to work. I haven't used ChatGPT with Alteryx but perhaps it can help.
re: sarcasm --- I use sarcasm quite often on his board because there is an absurd sense of entitlement from some posters. Not saying this is you --- but some have that. Your other thread --- not this one --- may have deserved it. Anytime you go to ask for help on something from free resources --- try to be as specific as possible --- and try to provide people with the details that they'll need. This is true here, reddit, stack overflow, wherever.