When you add a Python script as a source to a page, CalcTree is ready to analyse and map its input and output variables so you can add them to pages. 'Inputs' are parameters ready to receive a value, and 'outputs' are parameters that will return results.


Define inputs
  1. Define your input variables in your Python environment as CalcTree input parameters, 'CTInput(default=1)'.
  2. Set the CalcTree parameter default value in brackets. '(default=1)'.
  3. Initiate the CalcTree class, Inputs() in your script.
Defining and activating inputs
Use inputs in your Python script
  1. To use your newly defined CalcTree input parameters in the rest of your Python script, call the input using '
Calling an input in a Python script
Define outputs
  1. All variables defined outside of functions will become outputs.

Updating parameter mappings
  1. Changes to your Python script will not impact parameters mapped to CalcTree until you push 'Update'.
  2. Click on 'Update' at any time to update the input and output parameter mappings.

Use Python parameters in CalcTree
  1. Now, your Python variables are mapped as parameters on CalcTree. They can be used on your page like any other parameter in your workspace. Read more about CalcTree parameters here.
  2. Create a calculation template or report with Python parameters. Anyone in your Workspace can change the parameter values on the page, and your Python script will automatically run in the background.
  3. You can even chain parameters from different sources to create multi-step calculations across Python, Spreadsheets and Mathematical expressions.

Still have more questions?

Join the conversation on Slack below!