I am so proud of this app!
I learned a lot about the Tiny DB Component, how to do simple search functions and how to deal with a number of other issues. Several features that I wanted to include in the No Texting While Driving App were simply too much for me to figure out a couple of weeks ago, but this week I got them!
One of the most important things I learned has to do with debugging. It is good practice to test and identify the issue before attempting to fix it. This sounds incredibly obvious in retrospect, but the truth is, I spent a lot of time trying to fix something that ended up not being the problem at all. Fewer assumptions and more testing would have saved me time and frustration!
What I'm most pleased about this week was my ability to apply learned methods to new situations. The best example of this was using an index variable to display a list of items. In the tutorial, this method was used to display a list of items after a user has selected an item from a list picker component. The first new situation in which I applied this "index" method was the following:
I wanted to add a search function to the app. Because of time constraints, the search function is limited to only searching the company name list, but I think I will be able to figure out how to search all lists in the weeks to come. I found a tutorial which showed me how to search for items within a list, but the results of the search were limited to showing the number of occurrences rather than showing the occurrences themselves (e.g. Results = 3). So I had to figure out a way of displaying the information. My solution, although imperfect, is a great beginning for a more sophisticated search that I hope to accomplish in the future. I used the "for range" and "text=" blocks to create a temporary "index" variable and to compare the text of the search field to the available text in the list. If two texts match, the temporary index variable is used to determine the overall "index variable" which then calls up and displays the information in that position of the list. I had a glass of wine after figuring that one out!
The issues to fix in the future are: making a more thorough search (all lists), making it case-insensitive, searching for information "contained" in a list rather than exact (e.g. a search for "American School" would not result in any occurrences as I must type in "Taipei American School"), and dealing with multiple occurrences. Right now the search only displays the first found occurrence.
The next situation was this:
Assuming that there were no contacts entered into the app upon installing, or that the user had since deleted all of the entries, the initial screen showing contact information should be empty.
If, however, the user enters new contact information, the app should be able to display it. This requires multiple variable lists (contact names, phones numbers, addresses, etc), a Tiny DB and an index variable (to determine the list position of the information to be shown). I thought that it would work simply by setting the "Index" variable at "1."
But it didn't. I took a closer look at the tutorial and noticed that I was missing some required information. I needed to tell the app what the number "1" meant. In the tutorial, this was done by the user selecting an item from the list and essentially "telling" the app that the position of that item in the list was the meaning of the number. So I needed to find a way of doing this without requiring a user to select from a list (as I wanted the item to be shown automatically when the screen initializes).
Then the fun began...
My solution was this: the search function! I used what I had learned in the search function to solve the problem. In the search function, the user types in a text to "find" and a temporary variable is used to search the list to find a match and create an overall index variable. So, for the screen initialize situation, I created an "if" scenario - "if" there is no contact information stored in the app and a new item is entered, the text of the "company" name is saved as a separate tag in the tiny DB. Then, when the screen initializes, I get the text from the tiny DB, put it in a "hidden" label, compare that information with the items in the company name list and create an index variable, just as in the search function. Voila! Another glass of wine for me!
It was truly hard work this week but I'm very pleased with the results. I hope to get this app the way I want it - it will be a valuable tool for me in my job search in Taiwan!
I learned a lot about the Tiny DB Component, how to do simple search functions and how to deal with a number of other issues. Several features that I wanted to include in the No Texting While Driving App were simply too much for me to figure out a couple of weeks ago, but this week I got them!
One of the most important things I learned has to do with debugging. It is good practice to test and identify the issue before attempting to fix it. This sounds incredibly obvious in retrospect, but the truth is, I spent a lot of time trying to fix something that ended up not being the problem at all. Fewer assumptions and more testing would have saved me time and frustration!
What I'm most pleased about this week was my ability to apply learned methods to new situations. The best example of this was using an index variable to display a list of items. In the tutorial, this method was used to display a list of items after a user has selected an item from a list picker component. The first new situation in which I applied this "index" method was the following:
I wanted to add a search function to the app. Because of time constraints, the search function is limited to only searching the company name list, but I think I will be able to figure out how to search all lists in the weeks to come. I found a tutorial which showed me how to search for items within a list, but the results of the search were limited to showing the number of occurrences rather than showing the occurrences themselves (e.g. Results = 3). So I had to figure out a way of displaying the information. My solution, although imperfect, is a great beginning for a more sophisticated search that I hope to accomplish in the future. I used the "for range" and "text=" blocks to create a temporary "index" variable and to compare the text of the search field to the available text in the list. If two texts match, the temporary index variable is used to determine the overall "index variable" which then calls up and displays the information in that position of the list. I had a glass of wine after figuring that one out!
The issues to fix in the future are: making a more thorough search (all lists), making it case-insensitive, searching for information "contained" in a list rather than exact (e.g. a search for "American School" would not result in any occurrences as I must type in "Taipei American School"), and dealing with multiple occurrences. Right now the search only displays the first found occurrence.
The next situation was this:
Assuming that there were no contacts entered into the app upon installing, or that the user had since deleted all of the entries, the initial screen showing contact information should be empty.
If, however, the user enters new contact information, the app should be able to display it. This requires multiple variable lists (contact names, phones numbers, addresses, etc), a Tiny DB and an index variable (to determine the list position of the information to be shown). I thought that it would work simply by setting the "Index" variable at "1."
But it didn't. I took a closer look at the tutorial and noticed that I was missing some required information. I needed to tell the app what the number "1" meant. In the tutorial, this was done by the user selecting an item from the list and essentially "telling" the app that the position of that item in the list was the meaning of the number. So I needed to find a way of doing this without requiring a user to select from a list (as I wanted the item to be shown automatically when the screen initializes).
Then the fun began...
My solution was this: the search function! I used what I had learned in the search function to solve the problem. In the search function, the user types in a text to "find" and a temporary variable is used to search the list to find a match and create an overall index variable. So, for the screen initialize situation, I created an "if" scenario - "if" there is no contact information stored in the app and a new item is entered, the text of the "company" name is saved as a separate tag in the tiny DB. Then, when the screen initializes, I get the text from the tiny DB, put it in a "hidden" label, compare that information with the items in the company name list and create an index variable, just as in the search function. Voila! Another glass of wine for me!
It was truly hard work this week but I'm very pleased with the results. I hope to get this app the way I want it - it will be a valuable tool for me in my job search in Taiwan!