Pass a variable as condition in If activity, where variable contains complete condition as a string

Hi,

I want to pass a variable as condition in If activity, where variable contains the complete condition as string.
Like -
My condition is assigned to the variable -
variable1 = ‘row1.item(“Name”)=row2.item(“Name”)’

Condition

Can someone help me to achieve this???

Why would you want to do that? Can’t you just write the condition row1.item(“Name”).tostring=row2.item(“Name”).tostring in the If-statement?

Anyway, if you want to it that way you need to do something like this when you assign value to “variable1” (which doesn’t make any sense):
variable1 = If(row1.item(“Name”).tostring=row2.item(“Name”).tostring, true, false)
and variable1 needs to be a boolean

this might get you started…

@Obsev, I have already tried the solution you are trying to convey, but it didn’t worked.

@AkshaySandhu, thanks for the comment, but can we achieve this without using any external library ?

Hmm, can you please give an example when you would want to do it that way?

I attached a workflow of how I meant, but I guess that isn’t what you are looking for. Also it would make more sense to just put the condition in the IF-statement. Main.xaml (6.4 KB)

Yes, I agree its better to put the condition directly into the IF condition, but my requirements are different i need to read the condition from the config file which will be passed to IF condition.

i need to read the condition from the config

That made it interesting! I attached an idea to a solution, it ain’t pretty but it works, but it will need some work when there is quotes in the condition. ForForum.7z (2.5 KB)

1 Like

@vijain did you try it?

It works like a charm. Thanks!!

1 Like

Thank you very much, it worked very well ! This solution is super useful.
Thank you very very very much :partying_face: :slightly_smiling_face:

1 Like