UDF Call#

Overview#

UDF Call is a tool to run user defined functions (UDFs) in Excel. We provide a platform for users to write their Python functions. And after importing successfully, the users can run their functions by filling the UDF Call form.

Examples#

Example 1: Numeric Variables#

Here is a step-by-step example of running an external function with numeric variables in Finplicity.

  1. Before running a user defined function, the users are supposed to select the associated Python file by opening Finplicity, and then click User Defined Functions > Configure, and write it by User Defined Functions > Python Editor. You need to select your preferred code editor to write Python function. Write Python function in the script and save it. Now you have finished writing user defined function, and you can run it. In this example, the pre-written python function called “exp_1.” As it shown below, it will do a simple sum of two variables.

    The data to run an example using the “exp_1” function is as shown below.

  2. Open Finplicity, and then click User Defined Functions > New Task. The form of UDF Call will appear, as shown below.

  3. Use the dropdown to select the function’s name which you want to use. The functions’ name will be shown automatically in the dropdown when you first open the form. But you can always click “Import UDF’s” button to refresh the name list. In this example, select “exp_1.” You will see the variables’ name listed in the box below.

  4. Click the variable’s name to edit its location. In this example, click “a1.” Then, the form shown below will pop up.

  5. Fill all the variables’ location. Select the Excel cell or range location for variable’s location. In this example, select “A2:A6” for “a1,” select “B2:B6” for “a2.”

  6. Select the Excel cell or range for output location. In this example, select “D2.”

  7. Now you have finished all the required fields in the form, and you can click “Run” to run your customized function or click “Save” to save the task. Below is the result in this example.

Example 2: Text and Boolean Variables#

Here is a step-by-step example of running an external function with text and Boolean variables in Finplicity.

  1. Before running a user defined function, the users are supposed to select the associated Python file by opening Finplicity, and then click User Defined Functions > Configure, and write it by User Defined Functions > Python Editor. You need to select your preferred code editor to write Python function. Write Python function in the script and save it. Now you have finished writing user defined function, and you can run it. In this example, the pre-written python function called “exp_2.” As it shown below, it will return variable a2 if variable a1 is true and “None” if variable a2 is false.

    The data to run an example using the “exp_2” function is as shown below.

  2. Open Finplicity, and then click User Defined Functions > New Task. The form of UDF Call will appear, as shown below.

  3. Use the dropdown to select the function’s name which you want to use. The functions’ name will be shown automatically in the dropdown when you first open the form. But you can always click “Import UDF’s” button to refresh the name list. In this example, select “exp_2.” You will see the variables’ name listed in the box below.

  4. Click the variable’s name to edit its location. In this example, click “a1.” Then, the form shown below will pop up.

  5. Fill all the variables’ location. Select the Excel cell or range location for variable’s location. In this example, select “A2” for “a1” data. Select “B2:B3” for “a2” data.

  6. Select the Excel cell or range for output location. In this example, select “D2.”

  7. Now you have finished all the required fields in the form, and you can click “Run” to run your customized function or click “Save” to save the task. Below is the result in this example.

FAQ#

  • Can I select an Excel range for Boolean variable?

No, you can only select a single cell for Boolean variable. Otherwise, a warning message will pop up.

  • Can I select an Excel range for text variable?

Yes, you can set an Excel range for text variable.

  • An Excel range of text/number variable will be read in as what kind of Python class?

An Excel range of text variable will be read as tuple. An Excel range of number variable will be read as NumPy array.