The layout of the components would look like this:
In the following screenshots we can see how the rest of the components would be:
We define four global variables:
- Table_fusiontable: we will use it to save the values obtained from the Fusion Table "Gluten Free" when it is called (when the application starts and when we press the Reload button). Since when making the query to the Fusion Table the data are obtained in "csv" format, we must convert them to "list" format before being saved in the variable.
- Ratings: This list type variable has the following structure
No ratings of Restaurant 1 |
Average rating of Restaurant 1 |
No ratings of Restaurant 2 |
Average rating of Restaurant 2 |
No ratings of Restaurant 3 |
Average rating of Restaurant 3 |
No ratings of Restaurant 4 |
Average rating of Restaurant 4 |
The values in the table are obtained from the Table_fusiontable list using the procedures "bulding_global_ratings" and "calculate_average_rating"
- Average_rating: we keep the average of the scores that a restaurant has obtained
- Length_table_fusiontable: Stores the number of rows that the Table_fusiontable list contains. This data is used in the construction of the Ratings table
When we start the App we call the "Gluten Free" Table Fusion to obtain its values. Note that it is necessary to indicate the identifier of the table (tableId). On page 17 of this document we indicate where we can find this identifier