Collect and sort scores with the same email address in the list

The data I get from google spreadsheets includes the user's name, date, e-mail and score information. I look at this information, how can I calculate how many points the person got in total

You need to search the List called tumVeriler perhaps.(which is a list of csv of the game outcome ???.)

Search the List for the email, and for each occurrence of that email record the points by adding the points to another List. Total the items in the points list to show the person's total points.

One way to search a List
https://imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/

There is a guide to the advanced list blocks at
https://ai2.appinventor.mit.edu/reference/concepts/pholo.html

Since Google Sheets has your data, you can add a summary sheet referring to your detailed scores sheet. Read Google's help on their GROUP functions.

Also see gviz options at

for SQL-like summarization options.


I got all the e-mail addresses in this way, but I think I did not fully understand the method you said. I want to take the scores of these e-mails and calculate which e-mail address got how many points and sort it.

Let me take a look at the grouping feature of google spreadsheets, I want to make it simple and plain for middle school students to understand.

1after you get the responseContent, convert to list with 'LIST FROM CSV TABLE'.
2 traverse the list, pick the email and score. save them to a Dictionary, email as key, score as value.
3 before save to Dictionary, you need to check if the key exists. if no, then just save it. if already exist, then you need to add the score to the exist value.

do i have to start like this, i am using the dictionaries section for the first time can you help me

You need to use 'Set Value For Key'.

You listed only the emails. Your new List with the emails you want must also pull out all the members of the item. (5 items including email). You are interested in the 5th item which is the points earned. The first for each number makes a list of all the scorers for the email, the second for each number totals the individual scores.

you probably do not need the grouping feature of google sheets. You could use code similar to this

Instead of pointList in the example substitute the list you make from the List called tumVeriler (with only the email you want to score totals.)

Here is a sample sheet for a Pizza restaurant, with two sheets:

  • a detail order item sheet with one row per item per order, and
  • a summary sheet with a formula summing the costs per customer order.

Detail Sheet:


This sheet has one row per food item per customer order.
All cells are just numbers and text filled in by the app.
Important columns are

  • C contains customer name
  • H contains total charge for that row's food item

Summary Sheet:
OrderData Sheet
This has one summary row per customer, based on customer name.

  • Column B has the customer name
  • Column C has an =SUMIF() formula built by the app to total just that customer's food costs.

Yo maintain these sheets, the app has start a new row with the formula and customer name when starting a new order, then add rows matching the customer name to the other sheet as he gets food.

Google help on =SUMIF():

I'm getting these errors right now I couldn't reach the result :frowning:


So do I have to collect the points and take them to a different page?

You are getting close I think.

If you share your aia, I may be able to help.

Otherwise I need to know what the output of tumVeriler is before you try to sort it using makenewsortedlistfrom response content. You got the runtime error message when you attempted to sort. For the moment,, let us see if you can get a json response as the responseContent.

Your do it for Label1 is " " because you do not assign tumVeriler to a Label1.

You know the difference between a Google Sheet and an AI2 Screen, right?
These are my Google Sheets ...

There is no need for a different page. Just change the sheet name in your references to the sheets.

responseContent is always text.

The sort block you used only works on simple lists, not tables (lists of lists).

If you want to sort it like a table, you have to turn the text into a table, using the appropriate list from csv table conversion block.

lists_from_csv_table

Then you use this block to sort the table:
lists_sort_comparator

Seems to work. :slight_smile:

Depends on what you want as a result.
How would you tell that sort block you want it sorted by the second or third column of the table?

but I am not :astonished: but I could sort on any column using
sorton5thItem
to sort on the fifth column. But Ozzy wants to collect scores based on the first column so the example was simple without those blocks.

It will sort the pointList3 in ascending order of the 5th item which will be 7,11,50 :astonished:

See this tutorial showing how simple it is to sort by columns .

@Ceit89 you can filter your main list using these Blocks. The example filters on 'butter'; you can use the eMail address I think.

filterList

Perhaps this is clearer
filterSort

I forgot I has this sample in stock:

here is an example for above:

1 Like