Hi Community,
In the Config file Settings tab I have a ‘newFolder’ in the Name column and it’s file path in the Value column.
How do I use that value in a workflow file I invoke in the Process state?
Thanks in advance!
Hi Community,
In the Config file Settings tab I have a ‘newFolder’ in the Name column and it’s file path in the Value column.
How do I use that value in a workflow file I invoke in the Process state?
Thanks in advance!
Hi Jessica!
Since Config is a Dictionary<String, Object>, for you to retrieve the value of your key ‘newFolder’ you need to access it.
In your Process.xaml, you can access the value with the following code:
in_Config("newFolder").ToString
Cheers!
Hi!
Absolutely. I wrote a write line activity in_Config(“newFolder”).tostring in the process state right before the invoked workflow and it did not work. Is that how I’m supposed to access it?
If you want it to write that out, then yes. However, I’m guessing you actually are using this for a save path or something similar. I’d consider using an assign activity. Assign a variable (such as newFolder) the value of in_Config(“newfolder”).ToString and then use that variable where you need it.
Just because it hasn’t been mentioned yet, you will want to make sure your config file is read it correctly in init and that it is being passed correctly as an argument to the other areas of your workflow as needed.
In that case, you need to check the scope of the variable, if you are in the Process state but not in the Process.xaml workflow, the Config dictionary is called Config, and you can access its values by simply typing
Config("newFolder").ToString
You can read more about arguments, variables and scope here and here
I wrote the assign activity in the Process state right before the invoked workflow file
created newFolder variable for Process state. newFolder = in_Config(“newFolder”).tostring and it did not work.
Looks like my config file is read correctly in initallsettings. Those arguments are:
in_configfile in string "data\config.xlsx
in_configsheets in string {“settings”, “constants”}
out_config out dictionary<string,object> Config
If you add a break point to the Invoke workflow activity, and, in the watch panel add the variable newFolder, does the variable contain the value you had anticipated once it breaks at the invoke?
Inside of the invoked workflow, have you added an argument and then set that argument equal to the variable newFolder in the invoked workflows arguments?
No it does not contain the value I anticipated.
Inside the invoked workflow the newFolder is a variable, not an argument.
This is where I’m the most confused- How do I add an argument and set that equal to the variable newFolder in the invoked workflows arguments? What does that look like?
I’d highly recommend reading up on this in UiPaths documentation, or going through some of the academy training on this if you haven’t, as those can explain much better. But, for now, I’ll try to add some screenshots that hopefully will help to explain. Two areas to consider when dealing with arguments. The arguments panel inside of the workflow you invoke:
And the Invoked workflows arguments panel, accessed via clicking on the Import Arguments on the invoked activity:
For in arguments, to add a new argument, you can Open the workflow, and add a new argument (such as in_Config) to the arguments panel, as shown in the first screenshot. Once that is done, save the workflow. Go back and look at the import arguments for this invoke. You’ll notice the color of the number has changed:
If you click the import arguments, you’ll see your newly added argument. Then, you just need to add your variable and click ok.
Hopefully this will help you work through some of this.
Keep in mind that arguments are in, out or io (in/out). Depending on what you need, you’ll want to make sure the direction matches and your variables for them are setup correctly.
Thanks for the feedback! It was helpful in diagnosing my problem.
I removed the variables in the invoked workflows that matched the ‘Name’ value in the Config Settings tab and then placed those variables as arguments in the argument panel within the invoked workflow.
Outside the workflow but within the states i.e. InitAllSettings, InitAllApplications, Process- I assigned values ex. newFolder= in_config(“newFolder”).tostring for each value I wanted to get from the Config file Settings tab.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.