Ai2 - Number crunching !

289 views
Skip to first unread message
Assigned to aget...@gmail.com by steve....@gmail.com

John Rands

unread,
Mar 6, 2014, 6:31:27 AM3/6/14
to mitappinv...@googlegroups.com
Hi all,
Using Ai2
Windows 7
Chrome

My apologies in advance if my question is considered mundane or stupid !!

I am a 'silver user' & new to Ai2, have lots of experience with making routines in Excel (so can follow/create logical paths etc) of which many are used on my phone & tablet.
Discovering Ai2 seemed a good way to make routines more 'slick' and easier to use !!
I am not interested in games, bouncing balls etc.but mainly interested in simple number crunching for both hobbies and work (CEng in lighting).

My task is as follows (to replicate one excel routine used):
I have 3 user input values (currently from drop-down box but not important to be so)
I have one calculated value from  2 of the 3 user inputs that is used later on.
I also have 3 in-built fixed conversion values
The output, once the 3 user inputs are entered give the desired result.
Functions applied are simple X & / so no radians etc.

I discovered Ai via Mike McGrath's book 'Building Android Apps' however this is for Ai1 (Classic) and I would prefer to use Ai2 where information is as yet limited. I have tried to follow books Ai1 block building logic but penny hasn't dropped in Ai2.

Can anyone point me in a good direction to build app as described and focusing on number input / output display ?
I'm sure once I have managed to build above simple routine in Ai2 I can apply to other routines currently used in Excel.

Many thanks in advance for any assistance.

Regards

John



Scott Ferguson

unread,
Mar 6, 2014, 9:23:13 AM3/6/14
to mitappinv...@googlegroups.com
This is the perfect match for App Inventor as one of it's strong points is number crunching.
This includes support for imaginary numbers: a+bi (needed when you want the square root of a negative number), scientific notation: 3.14e-7, etc.
There is a function to convert to radians but degrees is the default.

The data entry part is a snap as well.
I have been unable to find a good example in AI2 for what you want to do but it should be fairly simple.

I have 3 user input values (currently from drop-down box but not important to be so)
In App Inventor you can create a ListPicker instance in the Designer Viewer and on the right put the three values in the Elements box separated by commas.
By default it will be named ListPicker1.

I have one calculated value from  2 of the 3 user inputs that is used later on.
I also have 3 in-built fixed conversion values
The output, once the 3 user inputs are entered give the desired result.
Functions applied are simple X & / so no radians etc.

All of the above can be done with local variables in one Button Click block.

If you prefer, we can do a Google Hangout and I will show you how to do it using the share screens feature.
---
Scott

John Rands

unread,
Mar 6, 2014, 12:43:12 PM3/6/14
to mitappinv...@googlegroups.com
Hi Scott,
Many thanks for your comments very helpful.
I will continue to experiment along the lines you have mentioned.
I'm sure once I get to grips with the logic of the blocks it will be simple.

I'm not a Hangout user so maybe not a good option !

If you don't consider me very cheeky perhaps you could post a screenshot of a typical block arrangement that I could replicate and develop ?  Iv'e designed the screens (I'm using imperial and metric options as well as a text instruction screen) and have managed to get the navigation sorted with 'on button press go to screen#' so chuffed with myself for that albeit simple element.
Its just which blocks to use/start with and their relationship for the maths, hence the cheeky question !
Again many thanks for response.

John

Abraham Getzler

unread,
Mar 7, 2014, 11:29:54 AM3/7/14
to mitappinv...@googlegroups.com
John,

Here is a link to a video where a 4 function calculator is built from the ground up.

http://www.youtube.com/watch?v=1BuKR7S2Gl0

It should be usable in either version of App Inventor,
and should show you how to handle input/output.

If you are having problems with conversions or formulas,
could you post them here?

If you want to post blocks, take a screen shot of them in the Block Editor
using your PrtSc key, save them using your Paint program,
and post them as files here.

That would be easier on the people reading the posts than
lab samples.

ABG

Scott Ferguson

unread,
Mar 8, 2014, 11:29:44 AM3/8/14
to mitappinv...@googlegroups.com
It would be easiest if you would export and attach here the aia file and provide a description of the input values and formula used.
I could then make the changes and post the blocks from your app here and return the 'fixed' project as an attachment.
It is mostly a matter of putting the math blocks in the correct arrangement.
Once I have posted a picture of the blocks I can explain how they work.
---
Scott

John Rands

unread,
Mar 11, 2014, 12:43:00 PM3/11/14
to mitappinv...@googlegroups.com
Hi Scott et al,

Update:
With Scott's very kind assistance have now built 1st app !!
Whilst in Ai2 and connected to my mobile (Samsug Galaxy Mini 3 running Android 4.1.2) and chose drop-down pick list the list appeared for a millisecond then closed the app.
Before picklists added worked OK on phone.
However it runs on Nexus 7 absolutly great with no problems whatsoever.

Has anyone an idea of why this should be ?
Clearly something on the mobile but maybe something in the app could mitigate issue, as it worked before picklist added.

Any comments gratefully accepted !

John.

John Rands

unread,
Mar 11, 2014, 1:25:14 PM3/11/14
to mitappinv...@googlegroups.com

Hi Scott,
I have posted an update on the forum site as suggested.
Many thanks for assistance, I have replicated to the metric screen and all works fine.
Have also added screen image, rounded buttons etc.
The only thing I couldn't replicate was the down arrow icon for the list picker button, nothing on my keyboard would replicate this.

On the mobile, application loaded as apk and runs but the selection is not passed to the input box from the selected picklist item, but can type in numbers so workable.
Very strange as works great on Nexus 7.
Still as you say perhaps a quirk on the phone.

Again many thanks for assistance

Best regards

John

--
You received this message because you are subscribed to a topic in the Google Groups "MIT App Inventor Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mitappinventortest/nDLh83mzpMQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mitappinventort...@googlegroups.com.
Visit this group at http://groups.google.com/group/mitappinventortest.
To view this discussion on the web visit https://groups.google.com/d/msgid/mitappinventortest/d3d2f860-2bc1-4fac-9a02-544b64db6e82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Ferguson

unread,
Mar 11, 2014, 6:04:22 PM3/11/14
to mitappinv...@googlegroups.com
The only thing I couldn't replicate was the down arrow icon for the list picker button, nothing on my keyboard would replicate this.
Click the start menu button in Windows and type charmap in the textbox.
Press enter and a dialog with characters is displayed.
I selected the OpenSymbol font then used the select and copy buttons there to copy the smaller down triangle to the Windows clipboard, then pasted it in the textbox for the ListPicker.

---
Scott
To unsubscribe from this group and all its topics, send an email to mitappinventortest+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages