Can somebody help me with using the Constant (parameter) option in python. here is what i did so far
Here i define the name of the file Input function as "SelectFile"
Here i set the default value for the parameter.
Here i try to read the parameter just like in the R module. But with no success. How do i get this working....
regards Humberto
Solved! Go to Solution.
@kelkboom It currently cannot be done.
1) Make sure you don't run the entire workflow and pass a value that contains a single "\" (Your SelectFile value currently has several "\"). It will error out and delete all your python code. Alteryx is aware of the issue. I haven't checked, but I suppose it should not error out if you just doubled them all up to "\\". This is only a problem for reference shortcuts, as the juypter notebook is gracefully changing "\" to "\\" whenever your code includes a "\" (but reference shortcuts are done outside of that).
2) You should add your idea over here. My biggest complaint is that when you run the entire workflow, it will actually permanently replace the text. So your python code would become print("W:\......zip"). I think you should add your idea that it should also work when you run the cell as it currently does not work at all.
I get a lot of value from passing data this way and I think the python tool would be even better if it handled reference shortcuts similar to any other tool (and especially the R tool).
So I don't know if this accomplishes what you are looking for or not, and my Python is still fairly minimal, so if there's a reason why this won't accomplish your need, please let me know (you'll help me learn)!
Could you have a Text Input in your workflow, with the following configuration:
Question.SelectFile |
%Question.SelectFile% |
Then you could connect this to the Python tool, and rename the connection as Question.SelectFile (for consistency)
Finally, you could try the following Python code:
from ayx import Alteryx Alteryx.getIncomingConnectionNames() df = Alteryx.read("Question.SelectFile") SelectFile = df.iloc[0]['Question.SelectFile'] print(SelectFile)
I believe that the SelectFile parameter referenced above should be identical to what you are looking for.
User | Count |
---|---|
19 | |
15 | |
13 | |
9 | |
8 |