While we strive to make our modules as generic as possible, it’s impossible to know all the functionality someone is going to need. The beauty of the system is that you can create a first class module, register it, and then proceed on with creating your app.
However, there are times when I’m in a pinch to get some app done, and I don’t feel like creating a first class module for some silly parsing that needs to happen. I also don’t want to clog up the palette with domain specific or extremely data specific modules. Meet the code module!
The code module lets you write any c# or vb# code you want (well, there are some caveats). The module has several inputs including:
the code (duh!),
class name in the code,
name of the method you want to call,
input parameters to the method.
The input parameters are a list, and are mapped to each parameter in your method signature. So if you have 3 parameters, you should have 3 connections going into the parameters input. The module also supports the “params” keyword in your method, allowing you to code for a dynamic number of inputs.
Any code is sand-boxed in an isolated application domain. So you can’t do things like try and list directories, write to files, or anything else naughty!
This a very simple code module. It takes in 2 inputs, and returns a string. The return value of the method is the result of the module. If the method returns ‘void’, then the result is set to null.
Here’s the code for example module:
public class TestClass
public string TestMethod(string val1,
return val1 + " " + val2.ToString();
Latest posts by Lars Fiedler (see all)
- WIX: Scheduling a custom database upgrade to happen After=”InstallSqlData” and Before=”StartServices” - October 24, 2018
- When is a parameterized SQL query slower than having inline values? - May 17, 2018
- Composable shines versus Alteryx - April 17, 2018