How to pass the entire code in a variable to Invoke Code activity

Hi,

I have some lines of code which has some conditions in it. I don’t want to code it directly in “Invoke Code” activity.
I will store the entire code in text file. I will read and have the code in a variable(StrTest).
I need to pass only this variable to Invoke code activity.

If I do this, I am getting error as below: Any solutions:

Hi,

Save your code in batch file instead of text file using write text file activity. and use the below code to execute your code from invoke code activity.

System.Diagnostics.Process.Start(“C:\Kiran\VBCode.bat”) and place the path in a argument and pass it.

find the below screenshot for reference. just thought from my side. Please try your code by executing the command. thanks

Regards,
Kirankumar.

It is not working for me. There is no error also.

Hi Vignesh,

May i know what you are trying to achieve with the VB.net code so that i will also try at my end.

Regards,
Kirankumar.

I am having 60+ dt.select filters and data update query as below. I need to execute that 60+ lines in that Invoke code.
I am planning to store the 60 lines in excel or text and read that for passing into invoke code.
So that if there is any change in filter condition, no code change required.

dt.Select("[column1] = ‘123’").ToList().ForEach(Sub(row) row(“UseCase”) = “UC02a”)
dt.Select("[column2] = ‘abc’").ToList().ForEach(Sub(row) row(“UseCase”) = “UC02b”)

Did you try pasting the content you mentioned in batch file instead of text file and try to run the command i suggested in invoke code.

Yes, I pasted the code in bat file and run the command you provided. filter and updated not happened

oh ok in that case we have to go for some other method.

Any suggestions please? @Palaniyappan

Any solutions?

compiling code cannot be bypassed therefore loading source code as string will not work so far
the available options are dependend from task what is to achieved

also we can have a look here: