Block formula returning wrong result

Guys, please look at this block formula. The block formula returns wrong result which is completely different from the manual calculation. Please see the images from app inventor and the formula.

Please download and post each of those event block(s)/procedures here ...
(sample video)

We can't load your blocks into our Blocks Editor if you use screen copy/paste on them.

Also, if you switch all blocks to external inputs their nesting becomes clearer and they fit the screen better.

1 Like

I believe we could do with some more brackets in the written formula to indicate what the operators (+-x/) apply to


A reference to the original formula would also help.

1 Like

You now have a gang of three making demands McCarthy :joy:

We also need sample values for all the variables (e.g. Water Percent) and what the HGS_Percent should be when calculated using those sample values.

I can not see arithmetic operators used correctly in blocks accordence to manual formul. Also need to apply operator precedence using.

I have pasted the original formula along side the block formula.

Typical value of the variables are:
Water Percent = 97
Volume of Salt = 0.03
Oil Percent = 0
Salt Water WT = 8.36
Mud Weight = 8.8
The result should be HGS Percent = 0.33

Thanks for the observation. I will re-run it and see.

Got same wrong result. I may have pasted the adjusted block formula where I took out the bracket and subsequently the subtraction sign changed to arithmetic. Please if you may, run the block formula and see if you will obtain the right result 0.33. Thanks a lot for all your assistance.

Yes, it's correct to me, you need to re-arrange blocks smthing like this,


1 Like

see below if this will work

Many thanks for the reply. Please how did you arrange your block formulas vertically. Thanks a lot.

Hi Mareshu, how do I rearrange the blocks the way you did? Thanks a lot.

Right click on a block


select external inputs

1 Like

Right click on blocks switch between external and inline inputs

1 Like

Thanks a lot. I really appreciate.

1 Like

Thanks a lot @RamNaresh I rearranged it like yours and the result was spot on.

1 Like

@all, thanks a lot for the assist. I got my result. This community has been very helpful.

Thanks a lot @TIMAI2 for your prompt response.

1 Like