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.
How-To
- Define your input variables in your Python environment as CalcTree input parameters, 'CTInput(default=1)'.
- Set the CalcTree parameter default value in brackets. '(default=1)'.
- Initiate the CalcTree class, Inputs() in your script.
Defining and activating inputs
Use inputs in your Python script
- 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
- All variables defined outside of functions will become outputs.
Updating parameter mappings
- Changes to your Python script will not impact parameters mapped to CalcTree until you push 'Update'.
- Click on 'Update' at any time to update the input and output parameter mappings.
Use Python parameters in CalcTree
- 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.
- 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.
- 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!