2017년 3월 9일 목요일

Ai2 - Number crunching !


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.

--
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.

--
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 !

--
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.

--
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.

--
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.

--
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.


--
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.
--


댓글 없음:

댓글 쓰기