Sort database output

I am making a simple calculation form.
First I want the user to fill in the name for a new calculation (input), or pick an existing calculation. (dropdown)
In the input fields Area and Height I want to initial show the values of the existing database fields. depending on the chosen name of the existing calculation dropdown.

question 1: How can I sort the dropdown in a way that there are no empty or double fields in the dropdown values? I put the input of a new calculation name to the database with “create a new thing”

question 2: how can I show the intinal content from the fields in the area and height input, based on the chosen option from the dropdown?

with kind regard, Ruud

Why are there duplicates and empty’s on the Existing Calculation dropdown? You have to make sure that this doesnt happen by using conditionals on the ‘create new thing’ action.
For duplicates - don’t allow the creation of new calculations if an existing calculation already has the same inputted name
For empty names - don’t allow the creation of new things if the user did not input anything as the name.

You could use the :filter operator on the dropdown data source, however this is just hiding the problem, not fixing it.

Place the elements in a group which has a Datasource of ‘calculation’. When a user selects an existing calculation, use the action ‘display data in group’, (or use custom states), and display the selected calculation in the group.
Set the initial content of the inputs to Parent group’s Area/Height. You could also activate autobinding on the inputs, this would automatically fetch the current value of the calculation’s field, and update it as soon as the user types a new value.