How to apply a function to values in Wappler

i would like to take multiple data points and run a math function over the values., how would i accomplish that in wappler…

say i have 5 input boxes, the user plugs in a value in each of the 5 input boxes, i want to take those inputs and insert them into a function and return a result… how would i accomplish that in wappler…

if you can point me to documentation about applying functions to data and returning values that would be great

Hi. What do you mean by function?

If you have 5 fixed fields on a page, with 5 ids, you can access their values directly.
So if input is called numer1, you can get its value with expression number1.value. Best to use Wappler’s picker dialog to ensure correct qualification (it could be form1.number1.value or something else).

Im not worried about accessing the values that is straightforward, i want to know how do i call a function from say pressing a button… where do i store the function and how do i connect the function to the button, and how do i pass yhe 5 values as inputs to the function…, the function will do its thing and return a value or an array of values, lets assume its a JavaScript function

1 Like

Hi there @JR1

Personally I’m not a big fan of going into js unless I really cannot do something in Wappler itself.

If the function was not too complex I would do it with an AppConnect Flow, which is actioned in the user’s computer.

If it was more CPU intensive then I would write a Server Action so it is performed in PHP or Node on the server.

1 Like

In addition to what Teodor has suggested, you could create your function in JS, and then use FLOWS to call that JS function and pass required params using bindings.
This way, can keep your JS function clean of any dmx stuff.

1 Like