Good day. I would like to ask if there is a possibility that this platform can auto compute the simple multiplication that I want to develop in my app. Initially I compute it manually and make it as JPEG file then just button to open the image
the yellow highlighted part was the formula to multiply it.
Example at Age 1=10kg and I wanted to compute the defib joules need and it is 4j/kg so it became 40j
Now I want to ask if it is possible to do is just input the age for example and it will compute all the other data like this. There will be an input field for the age then all of the other will be computed on their respective boxes.
Thank you so much.
It is definitely possible. The question is how do you want to use the calculation data later?
Because this leads us to choosing the correct data and variable approach.
The easiest way is to create page variable for each of the fields that you want to calculate and do the “set page variable” flow function on the age input box logic canvas and connect the “Component onChange” event. Then bind each field respectively to the correct page variable.
This is the easy way but page variables will only be available in the app on this specific page. So if you want to use the same results on another page you can do the same just with app variables.
Now if you want to save the data to the on-device storage or any other storage I suggest building an object with properties that are respective to the fields. Then set each of the objects properties to the specific formulas.
Just a few screenshots to make it clearer:
Hope this helps and good luck
Thank you so much for your time helping. There will be no plans for the data, all I want is for it to show on the designated box because it will on just serve as a quick reference so that I will no longer compute everytime.
@Mihaly_Toth I managed to do the following.
I made a page variable for the weight and binded it on all of the other values since it is just a simple multiplication on the formula like the weight will be just multiplied to a certain value. If I type now the weight then I am already getting the right answer on the boxes below.
My next challenge now is how to bind the weight and the age together. In this scenario it does not follow the same condition to each age bracket.
ESTIMATE WEIGHT CALCULATIONS:
0 - 12 Months: (age x 0.5) + 4
1 - 5 years: (age x 2) + 8
6 - 14 years: (age x 3) + 7
Which makes me to my other idea that instead of doing the calculation for these part can it be done that if I will just type the age a constant value will just appear without calculation. If I will Enter 5 on the AGE 18 will appear on the WEIGHT tab without anymore calculations since in very age bracket there will be a diff computations. Please bear with me I am still a newbie and really wanted to learn. Thanks
This could be done via nested IF() formulas.
Let’s say You do a set pag variable and in the binding screen do something similar:
IF(pageVars.age<1, pageVars.age0.5+4, IF(1<=pageVars,age<5, pageVars.age2+8,…))
Now I am aware that this can get too complicated when we have way more ranges to check for. In those cases we can apply a different approach, for example creating an object with two properties, one would be the range identifier, the other would be the formula itself as a string. And we can replace the placeholder to the page variable etc. But I guess You do not need that advanced solution just yet.
@Mihaly_Toth I tried to copy the formula you gave but there are some errors
Well. First of all, sorry for my typos. I was writing from a phone. Before the 0.5 there is an asterisk missing. So pageVars.age*0.5
And there is a comma instead of a dot at a pageVars.age in the second part.
Second question, where do you try to set this value? Because it should not say “requires inversible formula” at the set page variable flow. It can write that if you set an input fields value to this formula. Because if the user types something it would not be able to do the formula again. That is why you need to have different variables for different input fields.
One last thing. Do not leave the formula ended with a comma. Close the required brackets to make sure it will work.
This is my plan I will bind age and weight 1&2 on the image and whatever the answer will be I will just type it on the other input weight tab to compute the rest
You do not need to type the result in again. You can reuse the result and set the values according to that.
If you do not want to create that many page variables it is perfectly fine. Just do not use input fields as view components. But instead use a container inside which you have two text view components. The first one should be the title and you can bind the second text value to the formula. (There you will not have “requires inversible formula” error).