Hi All! I am pretty new to AppGyver and am excited to now be a member of this community. I have been through all the tutorials but am still developing an intuition for how AppGyver “thinks” and have what I suppose is a relatively simple question but haven’t been able to figure out.
I am developing a statistical app that computes areas from distributions (normal etc) when the user inputs a value. For example, if the user inputs (via input field) 1.96, I want the app to compute and display 0.975. As the user specifies different inputs, I want the computed area to update and be displayed. I have included a screenshot of the logic I have so far on this and the function I use to compute the area but It wont’ update with new user input. Any help would be much appreciated.
Hello ! I am not much more advanced tbh but I would have gone this way
- create a number type page variable for the input named “Input”
- Create a second page variable named “output”
- Drag and drop UI text input field to the page
- Link the input text field to the page variable “Input”
- Add a button with “compute area” or something as button text
- On the logic part of the button add a “set page variable”, select “output” as the targeted variable and in the value enter a custom formula that uses the “Input” page variable.
- Add alert to the logic of the button after the set page variable to display the output
- Add another set page variable after the alert to set output and input back to empty once the user clicks on the X. This last part is not mandatory but it is more user friendly to avoid having to delete the input each time.
The logic would go this way : user writes input in the text field, it is stored within the “input” variable immediately. From there, by clicking on “compute area”, the button takes this input, makes the calculation and stores it into the “output” variable. Then the alert displays the output. Finally, once the user clicks the cross closing the alert and acknowledging the result, all the variables are set back to null and he can start again.
If you don’t want to make an output variable, you can also use custom JS to make the calculation inside the button logic and directly output the result. Alternatively, you could also add a text variable linked to the output so you don’t have to use the alert.
Might also be a way to directly store calculated result as it is typed to the Output value but I am not there yet
Hope it helps and I will stick around to see better ways to do this !
Thanks for the detailed steps on this! I’ll give it a go and let you know if it works.
Got it working. Thank you for your thoughts on this. They mainly confirmed what I was thinking and that I was on the right track. My issue ended up being that I needed to used the NUMBER() function with the input field variable in the formula function. My formula now looks like this
"Area is: " + ROUND(NORM_DIST(NUMBER(pageVars.input),NUMBER(appVars.mu),NUMBER(appVars.sd),true),4)
and it works perfectly. Thanks again!!
Great ! Thanks for the follow-up with your formula, might be usefull to others too