Input parameters
Input parameters are a core, unique part of Hex. Input parameters can be created in the Logic View and then added, optionally, to an app.
Adding an Input parameter
Add cell menus
Users can add Input parameters from the Add Cell menu at the top of the Logic View or from the + option between cells.
Right-click to replace
If you highlight and right-click some code, you can use the Add Input Parameter option to replace your code with an input value directly.
Configuring an Input parameter
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: reference name in code, prefixed with a $. Changing this name will automatically update references to this parameter throughout the Logic View.
Referencing Input parameters
Inputs are stored as Python variables, e.g., input_1
that can be accessed similar to any others.
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.