How do I match multiple MIT data pairs to repeating rows in Google sheet?

Hi,
I am complete newbie to MIT App Inventor and above all, been avoiding coding all my life I am very much inspired by the app but I am stuck already (due ... lack of coding experience for sure:) )

Anyway, I followed a very cute tutorial by Allison John (https://www.youtube.com/watch?v=SUFxL1awjO8), which I will much like to expand to fit a project for a charity.

Here is a summary of my issue

  1. I am able to single data pair (first row) into the spreadsheet as provided by Allison
  2. In my App, I have multiple rows and I want to load all these into the sheet after pressing the save button.
  3. I know I probab;y need a For Loop to iterate the entries but I cant quite figure it out.TACCO_School_Revenue_Logger.aia (182.9 KB)

Thanks in advance for your help!

You appear to have used webviewer instead of the web component to send your data....

I will do some reworking of your blocks, to include the handling of all locations.

Hi TIMA12,
Thanks for your quick response!

I noticed that too but seem to be limited to that selection only. I actually put it down to maybe accessing a different version of the app? As I said earlier, it seem to work just for a single line of data pair.

Cheers!

Yes, the webviewer will probably somehow run the code....

See the attached revised aia project.

I have switched you from webviewers to web components
I have added a lists of lists for the listpicker selections and values
The blocks iterate over this list using a counter and the Web got text block to run the procedure again
I have included a check to miss out any entries that are incomplete

I have not tested it but give it a go

TACCO_School_Revenue_Logger_Revised.aia|attachment (link removed)

You won't like it, because it means more coding, but there is, in my opinion, a better way of doing all this using google apps script.

See here:

Thanks! I have just tried it

when I click on button Save Data, I get the message "Data Upload Completed"

However, nothing goes over to the sheet yet. I am going to go over to see if there is something broken with the form itself.

Thanks again for your help so far!

Try changing the runSave procedure to this (removing the extra check):

Ha! ok I will have a look and get back to you!

Just a bit of a background. The end users are local school administrators somewhere in Africa. At the end of each day, they will use the app to directly send several admin data which will be automatically inserted into the spreadsheet for storage and analysis.

The current method has been to send a photo of the records on a sheet of paper via whatsapp, which is then manually copied and entered into a spreadsheet. With this app the data is submitted once!

If the best solution is through code, then that's fine! I just need some time to shake the coding phobia! :slight_smile:

After the latest edit .. I get only the timestamp values coming through but no other data ...

If you can change your spreadsheet sharing to "anyone with the link", I can do more testing. You can always change it back later, when we have it working.

I have spotted a schoolboy error on my part ! Give me a few minutes to change things and test again.

OK, this is better

TACCO_School_Revenue_Logger_Revised_2.aia (185.1 KB)

You will see from the spreadsheet that it now works (you will want to clear the test data)

I have added in a tidy up routine after the Data is sent, in order to reset all the selections and the values.

You might want to change this listpicker text to the selection you make?

yes, i was able to do that to initialize where I made picklist.text = picklist.element ... i will look at it again

Perfect it works!!! Thank you so much!

Hopefully, I can now base the other pages on this and add more functionaliy.

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)
 
Also see demo: multiscreen.aia
 
1 Like

Noted, Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.