So do I need to remove the names from the ElementsFromString? What does it mean if the elements are no longer used in the blocks? Instead of using a list picker, is there a better way that I make the user select a subtopic?
You know that the limit of screens is supposed to be 10? It is not a hard limit, but above that, it becomes really difficult to handle all screens and usually you will use too much memory. There are lots of ways to minimize your number of screens, look for example here:
http://ai2.appinventor.mit.edu/reference/other/manyscreens.html
Where is the spreadsheet that contains this information about Geography?
If you have subtopics, you could use an extra column to specify to which subtopic each keyword belongs. It would require a slightly more involved way of setting up the listviews.
It is not wise to put this information in your app, because if you change something to your spreadsheet, the app must be updated too and the other way around. It could become very difficult to maintain.
It’s a URL, here’s where it’s in the app:
I have tried using the column method, but am unable to retrieve the data using that, here’s how I structured my column:
Is there another way I can maintain the information better? Would using another list view be better than a list picker?
Hi Das,
After thinking a bit more about this, you do not have a coding problem, but you have a data problem. You are trying to define your subtopics in your app, but you have different subtopics for every category and I assume that the keywords may not be the same for every subtopic-category combination.
What I think you need is a google sheet with the following columns:
keyword, subtopic, category
For example, one row may be:
adaptation, climate change, geography
Then, you do not want to repeat subtopic definitions, because that becomes a maintenance nightmare, you need an additional sheet that has as columns:
subtopic, category, subtopic definition
so, for example, a row my be:
axial tilt, geography, The angle of earth's axis
You may also decide to split up this large big sheet into a sheet for every category, because it seems that the keywords are not applicable to all categories and that you have a lot of empty spots.
After you have done this, you will have a clear separation of data, which becomes a lot easier to maintain and where you never have to change the app if new data becomes available. That has as a clear advantage that you do not need to send new versions of you app to your users every time you make an update.
The AppInventor code will then be rather straightforward, along the lines of my example app. I can understand that this code is not easy to grasp, because it is abstract and generic. but, we are here to answer questions (sometimes).
If I’ve understood it right, does that mean that instead of having multiple Google sheets for each subject, I should do it in just one document? And then when I’m programming, all I need to do is when the user selects the category and subtopic is for the code to show them keywords from those rows?
So should I structured my data like this?
More or less. Actually, I was suggesting more sheets! But it depends how you want to correlate your data.
So far I was trying to understand why your geography screen did not show subtopic definitions. Now it does:
The problem was in this block:
Where in the original block you did not add an item to the list, which therefore stayed empty...
This makes the first two columns of the sheet all right, but what is the meaning of the rest??
And you can/should remove the elements from string in the design, because that will be really hard to keep right.
In your sheet on the frontpage, you do not have subtopics and keywords could apply to all categories. In that case you need only one table.
If however, for each category you have keywords and subtopics, which each have definitions that depend on the category, the story is very different. Could it also be that the definition for a keyword could depend on a specific subtopic within a category? Meaning that it could have different definitions even within one category? You could have a sheet looking somehow like your second one, but you still need a separate sheet to cover the subtopic definitions, otherwise you have to repeat them for every keyword.
So should I have a sheet with subtopic definitions (the keyword won’t have different definitions within one category) and another work with categories and subtopics so that when the user chooses a subtopic, it app them retrieves data from the subtopic definition sheet?
Yes. And the list of subtopics should be retrieved from your sheet and not as you have it now, defined in the app itself.
Update your sheets and app, and then post here again. Maybe I will have time to look at it.
I have created another google sheet for subtopics:
I’m having a bit of trouble programming…The filter by topic is working, but it’s more of a logic error this time. It is retrieving data from the subtopic sheet, but not according to the topic. It’s only showing the first topic list. I’ve attached the code blocks below.
aia:
Keyword_Literacy_App_copy.aia (482.1 KB)
Hi Das,
I spent too much time on this, but anyway, I think that your setup is not OK, because, again, you choose to put information in the app which should only go into a sheet.
Here is my new sheet:
I put it as CSV file into the updated version of the app.
Then, the code is quite involved. Using SQLite would have been nice, but I used dictionaries instead, with which I have no experience, therefore the too much time.
There is a new screen Hum_too that should do the trick. I only did the topic selection:
And here is the aia:
Keyword_Literacy_App_copy5.aia (488.5 KB)
Have fun with it. Questions: OK, but not tomorrow.
Thank you! The subtopic features works now!
I’ve never used dictionaries before and so am extremely new to the topic as well. It does make harder to understand how to programming works. I’ve been searching for some videos and forums on how dictionaries work on app inventor.
So do I need to use to same code for all the subjects?
Hi Das,
Yes, you can use the same code for all subjects.
In fact, if you would continue the path you were on, you would get an enormous app that probably would never work correctly, and which would be very hard to maintain and expand. In this solution you just expand or correct you Google sheets.
That said, the blocks I made could use some improvement, to also be able to use all keywords in a list.
It is Easter here, therefore there is little time to look at AI blocks. Next week I will send you an update, but maybe you found out how to improve this yourself.
Thank you so much for you help! I’ll keep an eye out for the update as well as try to improve my understanding of dictionaries.
Have a good Easter
The app works well now, I’m able to view both all keywords and filter them out by subtopics!
Hi Das,
You are not going to like this, but I rewrote the dictionary stuff again. See here:
I wrote it as a tutorial and used your data as an example. If you are not ok with that, I will change the example.
Of course you can keep using the setup as you have it now, it will work, also for your other subjects, as long as the Google sheets have the same setup of columns.
Here is a new .aia with the new blocks, that you can try:
Geo_4.aia (8.4 KB)
Cheers!
Hi, apologies for a delayed response
That's completely fine with me. Thank you once again for your help! I understand the setup now and will update it for other subjects.
Cheers!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.