So for one of the formulas I want it to display a range so for example if I enter 50 it will multiply that by 4 and 6 and display in my results label the answer 200-300. I'm not sure if that is even possible or if it is what math blocks would you use to do that?
this is just basic math. 50x4 =200, and 50x 6 =300. Why this is not possible?
I am trying to have it be displayed under 1 label as a range, not as 2 separate numbers/equations. So instead of showing it as 200 300 I want it to show it as the range of 200-300.
how about use Text Join block?
The app I am building is a calculator for respiratory therapists and one of the equations is for safe tidal volume ranges for an adult patient in ARDS. my goal is when you input the patient's ideal body weight it would then display the safe tidal volume range you can use for the patient. So in the example I used above if the patient's ideal body weight was 50kg, their safe tidal volume range would be 200-300mL
so this 4 and 6 is fixed? or adjustable?
Do the two calculations, then use a text join block to create a string, separating the two numbers with a hyphen.
So this is my issue with this I think, mind you I am toward the end of the semester for my first app design class so I am still fairly new with this, I am using a list picker to choose which equation you want, I have a list of 14 equations at the moment, how could I get it to perform the equation all under one formula? Below is a list of my blocks for the formula list and a screen shot of how the calculator looks itself using one of the other equations I have programmed in there..
OMG this did it haha. I used basically this but in a slightly different way and it worked. Thank you so much! I'm still noobish at this so I truly appreciate all of the help
This is another argument for the if/then/elseif ladder at both formula selection time, and at calculation time.
At Selection time set up your reusable text boxes and Labels.
At Calculate time do your multiple calculations and distribute the results into the Labels you set up at Selection time.
Not every formula requires input into all 3 text boxes. If the text blocks are left empty you get a message saying the operation yail-divide can not accept the accept the arguments:"....". If you change the text boxes so that they all are 0 then you get an error 3200 message if any of the boxes still contain the 0.
I tried to do an if/then box as pictured below to disable the empty text boxes but it doesn't seem to work. Any other thoughts on how to either ignore or disable an empty text box?
I also tried if the textbox is empty evaluate but ignore the result and that didn't seem to work either.
In your formula list (for example):
but all other formulas will generate a runtime error. You need to take @ABG's advice
So would I need to do this for like every single equation and would it still remain under when button1 click ?
I started a skeleton app for you, but I have to break off for a day or two.
I hope there is enough there for you to get a table based idea going for the input setup.
multicalc.aia (4.6 KB)
Ah okay, I think I got an idea of what to do with it. I'll give it a go and see what I can put together to get it to work. Truly appreciate you taking the time to help a noob like me out haha.
So I was definitely straining my brain a little too much with the error 3200 message. I ended up figuring out a work around without having to if/then all of my formulas and equations. I just made it ignore the error message. Now the app works as intended and I do not get any errors if 0 is left in any of the text boxes.
For what it's worth, here is a sample multipurpose calculator framework loaded with a few math formulae ...
![Capture2](https://community.appinventor.mit.edu/uploads/default/original/3X/b/2/b2057f026a97c85ac57a7ee95e4f942641669a72.png)
These global variables support the framework ...
The framework variables don't need to change as the formula list expands, unless a new formula exceeds the current limit on inputs or outputs.
These variables keep setup information for the formulas, by name:
The above dictionaries are used to set up the input area after choosing a calculation type.
multicalc.aia (8.0 KB)
It bothered me that this Click event had to count text box locations to line them up with their parameter names, so I figured out how to do that automatically, making the code easier to read and more reliable.
Old Event:
New Event, with added support functions:
Note that even if multiple formulae reuse the same input prompts, this will still work.
multicalc.aia (9.0 KB)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.