Lunch Menu App Help - Object Method Approach


Ok outline of this post
(1) current state of project with included attached *.aia file
(2) backstory to project
(3) future updates to project (and reason for this post):
(a) need method to read index (1) and (2) from object imported from CSV file
(b) need help with converting repeated code blocks from 'specific' to 'generic'

The current state of the included *.aia file is stable and functioning. The app will allow a user to click on buttons for the month of September 2021 (current month) and display the lunch menu for Northern Middle School, Somerset, Ky, USA. A public school.

The data the buttons are referencing are taken from a CSV file, which is saved to my Google Drive. Once the app starts the CSV data file is read into the app and converted into an object of 13 indexes. The individual indexes are then put together to form 25 separate objects of the 13 indexes. The 25 objects (representing the lunch menu of 13 items for the day) are assigned by an OBJECT INDEX NUMBER to the respective buttons of the month. The app is based on a calendar of 5 weeks for a month. The reason for the 5 weeks for a month is that the school system coordinates all of their lunch menus in this fashion. T

Currently this ability of the app to display this data when the user clicks on a button is STABLE and working. See attached *.aia file.

What is needed is a relabeling of the individual buttons for the month based on the imported DAY and DATE. These two data points are originally brought in by the CSV file. I am under the assumption that these two data points could be assigned to a new OBJECT (named something...) and then reiterated throughout the buttons based on the number of records imported from the CSV file that corresponds to the number of days of the month.

Please allow me to say that I understand that I could use a dataPicker approach to working with the labeling problem. I would not look to exploring this route of solution at this time. I firmly believe the best route for a solution would be in the understanding of working with an OBJECT solution method. This is mainly based on the data to be imported and the structure of how this data is to be brought into the project.

(b) Lastely, I am completely sure based on the number and format of repeated code in the project that the overall code base could be dramactically shorten.

NOTE: I am aware that there is extra code in the project that is currently diabled. These fragments (as they are disbaled) do not hinder the current functioning of the project. I have left them in the project as lines of thought I am exploring to tackle the button labeling problem.

In closing...
I hope I have been clear on the problems for the project as I understand them.
Thank you again for all who took to time to read this REALLY long post and would offer help.

Attachment Below:
lunchApp.aia (138.4 KB)

Before I open your .aia file, please see


I checked your menu download, and suggest using the full date in column 1 to allow lookup of the day of week using the date calculation blocks in the Clock component.

Wed,09/01,WG Big Daddy’s Pepperoni Pizza,Lasagna,Baked Potato,Spinach Salad,Sliced Pears,Fresh Apple,Sour Cream & Butter,Milk,-,-,-
Thu,09/02,Sub Sandwich,WG Chicken Sandwich,Lettuce Tomato,Cavendish Fries,Broccolie & Carrots,Grapes,Pineapple Tidbits,Milk,-,-,-
Fri,09/03,Chicken Strip,Meat Loaf,Sister Schubert's' Rolls,Green Beans,Corn,Fresh Fruits,Pineapple Tidbits,Milk,-,-,-
Mon,09/06,**No School - Labor Day**,-,-,-,-,-,-,-,-,-,-
Tue,09/07,Taco with Round Tortilla Chips,Chicken Fajita,Salsa & Cheese,Corn,Baked Potato,Lettuce & Tomato,Spanish Rice,Apple Sausce,Sliced Pears,Sour Cream & Butter,Milk
Wed,09/08,WG Calzone Pepperoni,WG Mini Corn Dogs,Grape Tomatoes,Green Beans,Fresh Orange Slices,Grapes,Milk,-,-,-,-
Thu,09/09,Spaghetti with Meat Sauce,WG Chicken Nugget,WG Bosco Sticks,California Blend,Spinach Salad,Fresh Oranges,Sliced Pears,Milk,-,-,-
Fri,09/10,Hot Dog on WG Bun,Sloppy Joe on WG Bun,Potato Wedge,Macaroni & Cheese,Fresh Apple Slices,Mandarin Oranges,Milk,-,-,-,-
Mon,09/13,WG Chicken Nuggets,WG Fish Nuggets,WG Sister Schubert's Roll,Mashed Potatoes,Fresh Baby Carrots,Fresh Apple Slices,Strawberry Kiwi Sidekick,Milk,-,-,-
Tue,09/14,Cheeseburger on WG Bun,Sloppy Joe on WG Bun,Cavendish Fries,Baked Beans,Creamy Cole Slaw,Grape Tomatoes,Watermelon,Sliced Peaches,Milk,-,-
Wed,09/15,WG Big Daddy’s Cheese Pizza,WG Chicken Sandwich on WG Bun,Vegetable Blend,Corn,Spinach Salad,Grapes,Mandarin Oranges,Milk,-,-,-
Thu,06/16,Hot Dog on WG Bun,Turkey Wrap,Cavendish Fries,Mixed Vegetables,Banana,Sliced Peaches,WG Nacho Doritos,Milk,-,-,-
Fri,09/17,WG Calzone Pepperoni,WG Mini Corn Dogs,Scalloped Potatoes,Broccoli & Carrots,Green Beans,Fresh Orange Slices,Grapes,Milk,-,-,-
Mon,09/20,WG Chicken Strips,Meat Loaf,Sister Schubert's' Rolls,Mashed Potatoes,Fresh Baby Carrots,Broccoli & Cheese,Fresh Fruits,Pineapple Tidbits,Milk,,
Tue,09/21,Taco w/ Round Tortilla Chips,Chicken Fajita,Salsa & Cheese,Corn,Baked Potato,Lettuce & Tomato,Spanish Rice,Apple Sausce,Sliced Pears,Sour Cream & Butter,Milk
Wed,09/22,WG Calzone Pepperoni,WG Mini Corn Dogs,Grape Tomatoes,Green Beans,Fresh Orange Slices,Grapes,Milk,-,-,-,-
Thu,09/23,Spaghetti w/ Meat Sauce,WG Chicken Nuggets,WG Bosco Sticks,California Blend,Green Peas,Fresh Orange Slices,Slces Pears,Milk,-,-,-
Fri,09/24,Hot Dog on WG Bun,Sloppy Joe on WG Bun,Baked Beans,Potato Wedge,Macaroni & Cheese,Fresh Apple Slices,Manadrin Oranges,Milk,-,-,-
Mon,09/27,WG Big Daddy’s Pepperoni Pizza,Lasagna,Baked Potato,Spinach Salad,Sliced Pears,Fresh Apple,Sour Cream & Butter,Milk,-,-,-
Tue,09/28,Sub Sandwich,WG Chicken Sandwich,Lettuce Tomato,Cavendish Fries,Baked Beans,Grapes,Pineapple Tidbits,Milk,-,-,-
Wed,09/29,Chicken Strips,Meat Loaf,Sister Schubert's' Rolls,Green Beans,Corn,Fresh Baby Carrots,Fresh Fruits,Pineapple Tidbits,Milk,-,-
Thu,09/30,Cheeseburger on WG Bun,Sloppy Joe on WG Bun,Lettuce & Tomato,Cavendish Fries,Creamy Cole Slaw,Grape Tomatoes,Watermelon,Sliced Peaches,Milk,-,-

Thank you for your suggestion on changing the data in column 1. I will not be able to do this. The *.csv file is constructed in its structure according to how the data is extracted from another document. The manager of the project will be limited in knowledge as to data modification and its useage. Quite literally, this person will move the data from it orignal source (calender grid format) to a csv fomat.

I have modified the project based on your suggestions and was already very familiar with your work You're awesome!!

Additionally, I looked at the following for info - "Button List".

The main genius for the struture of the project came from Hay Kel's "App Inventor 2: Read CSV file stored in Drive" video:
App Inventor 2: Read CSV file stored in Drive

The 'sticking' point of the project, in its current form is in the FORMATBUTTONS block. Probably in its setup or in its call. Below are the blocks I think are giving me trouble.

Also I am attaching the current state of the project.

Thanks again.lunchApp.aia (138.4 KB)