Checking a database and returning values

I have 1 input field connected to a data variable.

When I input in the input field and I click a button I want to check in the database and return a value into anther input field.

E.g an apple costs $5, orange costs $3
I input Apple, I click the button, it checks into the database, if data is available in the next input field it returns the value 5.
I input orange, I click the button, it checks the database, database does not have the price, so I input the value 3 manually.

I am able to make the app check the database and give a dialog box. but I do not know how to return the value.

Any help?

Hi, first I would bind the value of the 2nd input to a page variable. Then I would set its value after getting the data (where you are currently doing the alert) with a Set page variable flow function. This way the amount should show up in the 2nd input when the page variable’s value changes.