Input parameters
Input parameters are a core, unique part of Hex. Input parameters can be created in the Notebook view and then added, optionally, to an app.
- Users will need Can Edit permissions to create and edit input cells.
- Users with Can View App permissions and higher can interact with input cells in published Apps.
Add an Input cell
Cell menus
Add an Input cell to your project from the cell bar at the bottom of your Notebook, or from the + Add option between cells.
Right-click to replace code with a parameter
If you highlight and right-click some code in a Python or SQL cell, you can use the Add Input Parameter option to replace your code with an input value directly.
Configure an Input cell
All Input parameters have two base options, accessible from the configuration menu:
Label: text label displayed above the element, primarily in the App builder.
Name: the name of the Python variable, and the way to reference the output of the input parameter downstream in your project. Changing this name will automatically update references to the parameter throughout the Notebook.
Reference Input parameters
Inputs are stored as Python variables, e.g., input_1
that can be referenced throughout your project, just like other variables.
Input variables cannot have their values reassigned, e.g., input_1 = 123
will not effectively re-assign the parameter to 123
. Instead, you will have created a new variable, which is not connected to the input parameter, with the name input_1
and value 123
.
Inputs can be referenced in SQL cells through the use of Jinja, using syntax like {{ input_1 }}
. For an example of this, see our tutorial on parameterizing SQL queries.
Include Input parameters as URL parameters
For published apps, Input parameter values can be specified as part of the URL. For more information and examples, see our documentation on sharing links to Published apps.