Erasmus+



SMART WELLNESS. Healthy Youth through digital technology, science and entrepreneurial culture.

eTwinning

SmartWellness

IESBI

zsPacov

 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

After obtaining the result of the query, we save it in the variable Table_fusiontable.

We eliminate the first row of the table since it contains the header of the columns, that is, the Restaurant and Rating texts.

Next, we obtain the length of the table and call the procedure "bulding_global_ratings" (which in turn calls the procedure "calculate_average_rating") to construct the table corresponding to the variable Ratings.

Finally we show the results in the labels Label_R1_average, Label_R1_No_ratings, etc.

The programming block would look like this:

 

 

It should be noted that the previous blocks will be executed again every time we make a query or call to the Fusion Table Gluten Free, that is, every time we press the "Reload" button.

The choice of restaurant is made by pressing the corresponding button

The rating is entered using the slider

 

Finally, by pressing the "Send" button we send the number of restaurant and  rating to the Fusion Table Gluten Free to which they are added in a row.

 

 

 

If we open the Fusion Table Gluten Free in Drive we can see how, effectively, the table increases as we add ratings from the App.

  1. Enter Drive and click on My Drive / More / Connect more applications
Template Settings
Select color sample for all parameters
Red Green Blue Gray
Background Color
Text Color
Google Font
Body Font-size
Body Font-family
Scroll to top