Linking CSV Data to Dependent Dropdowns in CalcTree
Learn how to connect a CSV file to dynamic, dependent dropdown parameters in CalcTree using Python for structured data filtering and selection.
Last updated
Learn how to connect a CSV file to dynamic, dependent dropdown parameters in CalcTree using Python for structured data filtering and selection.
Last updated
This guide walks you through how to read structured data from a CSV file and build dependent dropdowns in CalcTree using Python and page Parameters. The pattern is commonly used in workflows that require a selection of section or material type and then extracting specific properties for the selection for use in calculations.
Upload your CSV file (e.g. CT - Standard Steel Section Capacity - DB.csv
) using the Files tab, then read it into a structured format using pandas. Learn more .
Once this is complete, create a new code source, and add the below code.
This loads your CSV into a list of dictionaries (records
) that are easy to filter by field name.
In the same code source get the unique values from a primary column (e.g. "Type"
):
Filter the list of available "Section"
values based on the currently selected "Section Type"
.
Make sure the "Type" name matches the parameter name you set, in this case, pg_type_list
.
Once the user has made a selection, extract the full row from the database and use its fields in your calculation.
Once a specific section is selected (e.g., "UB 203x102x23"
), use it to retrieve or process further data in a Code Source 3.
This approach lets you:
Link a CSV database to interactive parameters
Build dependent dropdowns (e.g. section type → section name)
Extract and use structured data in calculations
It’s ideal for any workflow where selections narrow down from a database — like selecting standard parts, profiles, or material specs.
Under the code source in the RHS panel, navigate to the type_list
parameter and insert to page. Then in the settings for this parameter, . Name your parameter something like pg_type_list
.
Under the code source in the RHS panel, navigate to the section_list
parameter and insert to page. Then in the settings for this parameter, . Name your parameter something like pg_type_list
.