Execute visual basic code

I want to process a list of data in object type List<String> from namespace System.Linq.
The easiest would be to use Visual Basic methods .First(), .RemoveAt(0) and .Count()
However none of the activities seem to be able to simply execute code.

Can I include System.Linq and execute a script within the xaml?

You can import System.Linq namespace (import tab after variables,arguements) and perform your logic. I think intellisense for linq is not available.

Hi vvaidya
Where do I enter my lines of code?

You can import Namespaces from bottom panel

Regards…!!
Aksh

Thanks aksh :smiley: I got the import solved. But where then do I enter my script?
Edit: I am not expecting a full-fledged IDE like Eclipse, but just a text window or a box or something.

Where you wants to use may be in some variable assignment? or in Iteration? It dependents on your need and now after importing all linq functions will be available for you to use here.

TL:DR
No box I have tried can handle the line:
List<String>.Add(<String>)
E.g. the Assign box expects my method to return a variable.

I have loaded an Excel file into a dataTable and now I am looping over a column. I want to assign the row values to a list by using strList.Add(row), but the Assign box is not designed to allow that.
Later I will be referring to the strList variable from different places in my state machine. I want to process the first item and then call strList.RemoveAt(0) until all values have been processed and removed.

I can also rephrase: I want to call a custom VB function.


Function hypotenuse(ByVal side1 As Single, ByVal side2 As Single) As Single Return Math.Sqrt((side1 ^ 2) + (side2 ^ 2)) End Function


How do I implement the function?

Math.xaml (5.9 KB)

Heheh thanks vvaidya. That xaml works but I was only using the hypotenuse function as an example.
How would this be implemented?

Private Function ListAppend(ByVal list As List(Of String), ByVal row As String) list.Add(row) End Function

Notice that I don’t want to return anything.

Custom activites are still best for custom complex code (at least until InvokeCode activity is widely available).

But for simple void method calls, you can always use InvokeMethod activity.

2 Likes

Does any of the training material demonstrate either how to build custom activities or how to implement a function in InvokeMethod?
I can’t find any comprehensive training examples.

Edit: What is the ETA on InvokeCode?

Invoke Code is out in Community Edition

1 Like

So that is why I can’t find it the box.
I’m currently developing in a trial of the full version.
Rather than uninstalling my full version, is there a graceful way to have both versions installed on one machine?