Get values from Config in a variable and use in If-condition

Related to:

For each row and add data row: Collection was modified enumeration operation might not execute - Help / Studio - UiPath Community Forum

if I want to get these values from config file like

S is name and values are

" CurrentRow(“Cost Center”).Equals(“AWS”) Or CurrentRow(“Cost Center”).Equals(“Python”) Or CurrentRow(“Cost Center”).Equals(“Power BI”) Or CurrentRow(“Reporting Manager”).Equals(“Srinivas”)

or
get array list from config.

then how do I put these in if condition as it takes only boolean variables

if
Config(“s”) is true
then
do some actions

The error is because you are looping through something then trying to modify it within the loop. You can’t do that. For example, this is incorrect…

For Each Row in myDT

  • AddRow to myDt

No that issue is resolved , please check the fresh thing which I mentioned above. Getting values from config and giving in if condition

Config is a dictionary. Config(“somefield”) is an object. To use it in an if, you have to use Config(“somefield”).ToString or CInt(Config(“somefield”).ToString) etc

That’s how you use it in your If.

1 Like

No we cant use like that. In if condition it should be boolean value that’s what I have written above

@Palaniyappan Please check my first post and help, it is related to the resolution you have provided earlier

You HAVE TO use it like that. You can’t just reference the object ie Config(“somevalue”) you MUST convert it to a value.

Just do Config(“somevalue”).ToString and test against the string “True” or string “False”

Fine

Then in config file
Have a key as CostCenter in one column and value as
AWS, PYTHON, POWER BI in another column

So while calling config file value mention like this in IF condition

Split(config(“CostCenter”).ToString, “,”).Contains(CurrentRow(“CostCenter”).ToString)

Cheers @Muralikrishna_Basani

1 Like

Bro those values are coming from data table like this:

image

I want to make that condition which is mentioned currently in the picture dynamic , so that it should come from config file

How do we do that please

" CurrentRow(“Cost Center”).Equals(“AWS”) Or CurrentRow(“Cost Center”).Equals(“Python”) Or CurrentRow(“Cost Center”).Equals(“Power BI”) Or CurrentRow(“Reporting Manager”).Equals(“Srinivas”)

It also contains CurrentRow(“Reporting Manager”).Equals(“Srinivas”)

I am also getting this error:

If: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

The workflow is in VB