Math formula confusion

I am trying to have this application have 3 inputs, do a math equation then output a number. I am not exactly sure where to do this or how to do this. The math equation is ((x/1,000,000)*y)*3785 = Z. The other formula is (((x/1,000,000)*y)*3785)/v = Z. Where would I put these formulas and whats the best way to have the x, y, v values to be entered to where the app can do the math equation?

Hi @Decon
In your collection you can create properties X , Y and Z OF TYPE NUMBER / not text !!!
next you can add a blank screen
add 3 input fields named x,y,z - type NUMBER too…
(you can se the default value to the database values - if existing - but not necessary for a test)

Add a button “titled : calculate button” for example
in the button properties look for ADD ACTION
in the action you should be able to find the “CREATE NEW formula” feature
The Field to write the result to will be Z
then clicking on the PEN in 3new formula RED “Oval” just write x/10000)*…etc etc
run Preview:
fill up fields X and Y with some arbitrary values, then press the “calculation button”
this will write the result in field Z

field names do not have to be the exact same name as your column names, but its better if you name them clearly so as not to confuse yourself…

There are slight modif but not really a best way until you know what and how you d want to feed your formula…
and voila

Hello @bibipac I’m having a little bit of trouble. I believe I created the formula but I dont know how to write the formula to the to the Z field. I have the custom formula inputted but cant seem to figure this out. I am not sure what I am doing wrong

Yes, so the dif is that Adalo is not Excell, you do not writte the formula in the Z field.
You writte it IN the Button you have to add…
then each tyme that you will press this one, it will execute any formula and writte the result --> to the Z field. Thats how it works in Adalo.

Make sure you use the ADD CREATE action to have access to Formulas you can modify as you wish…
See pic
you need to click on the Button to see the Menu for entenring the formulas
Next you search for the Z field : this is where you will write your formula !

When I go to put in a Form input all the options are blank.

I am trying to get it to output to the Ml/Min box but cant seem to get it to calculate or do that either.

correct, if you want to “link” each field to the DB, you can click on them “in the Screen layout” and insert the orignal field from the database…its on the right side (x* or T*).

But - normaly - since it you are in the CREATION Mode…
it is also normal that all field start emtpy…

To test the button, did you enter a value in Dosage and in Flow… ?
and then press Calculate ?
What happened ?

*Also, test it first with a simple formula i.e X x Y x 2
When it displays fine, go for your final complex formula…its safer to debug.

Capture d’écran de 2020-07-02 11-59-57 set type as Number…

I tried to calculate it and it inputted into the database as a zero. It would not do any formula for some reason.

Good thing, you are on the right way !!! :ok_hand:
just set so that the value of Z = X10 and test again.
if the correct values DOES NOT get registered it is then that the problems is in the formula syntax
Not in adalo, start simple do not go for the final formula
than modify it to be more and more complex
things like () and operand +
- location are important if its not done well, you ll end up with Zeros…
Also you need to write the Field INPUT names on their lines in the Button Script…I can see that you left them empty…or with INT(x) that is not enough…correct that too…they should appear in RED too

Also noted ; you have 2 fields mL/min.
try to delete 1 or rename the other
when renaming do not use symbols such as “/” or dots or “:”
keep names simple surch as letters spaces …and numbers (maybe)

“mL per Min” is better

I got the math formula to work but now I am running into an issue where i cant put a % in a decimal point. The formula will only read up to 0.0 when I need it to read as small as 0.0000.

you can read more digits, I remember doing a * of 2 numbers and getting 4 or 5 digits after.

For some reason when I do the formula it cant cant read a 0.03 input which is what i need because it is in a percentage form. It will read the .3 but whenever I put .03 or .003 it will not read the decimal and calculate it. Do you know if there is a way to fix this?

if its always going to be “0” you could use the prefix feature before .03, but I guess its just a format choice and should be able to display full number such as “0.003” …have you tested the other numbers formats or just use the “normal” format ?

Ive tried the number format and the normal format but it couldnt read either of them.

1 / 1000 = 0.001
Field format is Number, maybe something IN your formula is asking adalo NOT to display the 0.***
Capture d’écran de 2020-07-08 07-41-22

Capture d’écran de 2020-07-08 07-44-25

Did you succeed yet ? if no …share your formula here…I ll run it on my side. :man_shrugging:

I did not get it to work.

For some reason I cant get it to read the .03 in the % solution area.