# Create a monthly scoreboard with empty months filled :)

**URL:** <https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389>\
**Category:** Questions about Thunkable X\
**Created:** [November 7, 2020, 9:59am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389 "2020-11-07T09:59:24Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 7, 2020, 9:59am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/1 "2020-11-07T09:59:24Z")

</div>

Hello everyone,

I have a feature I’m struggling to build and ill be grateful if someone could help with it.  
I want to build a monthly scoreboard that will collect points in the local data source based on the month and year. every month there should be a new row created and the points are calculated there.

so far so good.  
my only problem is when there are months without points.  
what should I do to create a solution that will create rows with zero points based on the distance between the last filled month to the new one?

is anyone knows how to build such an algorithm?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [November 7, 2020, 11:53am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/2 "2020-11-07T11:53:23Z")

</div>

Nice idea, the answer would be helpful to me too.

---

<div class="post-metadata">

**Author:** ![eko.devs.apploroceo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eko.devs.apploroceo/32/93147_2.png) [@eko.devs.apploroceo](https://community.thunkable.com/u/eko.devs.apploroceo)\
**Post date:** [November 7, 2020, 12:04pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/3 "2020-11-07T12:04:51Z")

</div>

u can use firebase.but i am not firebase expert . just suggested

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 7, 2020, 11:12pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/4 "2020-11-07T23:12:19Z")

</div>

Can you explain more about what the row values would look like and if the user is entering them and why (what scores are they keeping track of)? Why does a zero value cause an issue?

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 7, 2020, 11:41pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/5 "2020-11-07T23:41:33Z")

</div>

![Screen Shot 2020-11-08 at 1.37.14](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/7/1784f37d7370d4a54704d42884cce2d98f45a13d.png)

The user gets points from completing tasks.  
Each month the points are summed and in the next month, it should add a new row with the new monthly points.  
When the user does not play for one month I want it to add all the missing months automatically when he creates the new month points.

Hope I explained it well.

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [November 8, 2020, 12:23am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/6 "2020-11-08T00:23:59Z")

</div>

One strategy would be:

1. Each time app is opened (start screen - start event)
2. Find the most recent year and month in the local db.
3. For each month between the last month in the local db and the current month
4. Add an entry for the year and month with all scores = 0
5. Then proceed to calculate the total Point as previously, with any totals found overwriting the zero score entries created in the previous step.

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 8, 2020, 1:14am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/7 "2020-11-08T01:14:38Z")

</div>

How do you 3?  
if the year has changed how do i calculate the right distance?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 8, 2020, 2:14am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/8 "2020-11-08T02:14:32Z")

</div>

What do you mean by “distance”? Do you mean physical distance on the screen as in x/y coordinates? Or time between months…? Perhaps a sketch of your scoreboard screen layout will help make this clearer.

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 8, 2020, 9:28am UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/9 "2020-11-08T09:28:56Z")

</div>

no, no physical. the time between months 🙂

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [November 8, 2020, 1:11pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/10 "2020-11-08T13:11:06Z")

</div>

There are a number of ways to approach this problem. Because of my many years of SQL database work, I tend to prefer something like this:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5a4c2db89c3027620e34c4e764ade002cdc4db51.png)

This approach eliminate calculating differences between dates, december to january comparisons, etc. It will loop a few extra times, but those loops do not do much so they will be extremely fast.

Happy Thunking!

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 14, 2020, 3:39pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/11 "2020-11-14T15:39:24Z")

</div>

Hey, I tried it, but unfortunately I wasn’t able to create the functionality I desire with the new rows. can you please show in more detail how I do it with the creation of new row when there’s a new month / how can I update the current month score?

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [November 14, 2020, 3:49pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/12 "2020-11-14T15:49:55Z")

</div>

I’m not sure how the rest of your app works, so it is hard to show an example.

Where are your scores coming from? Firebase? Airtable? Google Sheets? Variables inside the app?

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 14, 2020, 4:00pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/13 "2020-11-14T16:00:06Z")

</div>

variables inside the app…

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [November 14, 2020, 4:03pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/14 "2020-11-14T16:03:14Z")

</div>

Are the scores stored as lists? JSON Object? Can you share some images of how the variables are set?

And how are the variables in the app populated? do users type the values in?

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [November 14, 2020, 4:15pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/15 "2020-11-14T16:15:03Z")

</div>

They are stored in the local data source.  
when the user finishes a task he gets points.  
right now the points are calculated in a one table with one row on which all the calculations are.  
I want to add a new table with the same columns but just with option to split the row based on the current month.  
and off course leave empty rows when the user did nothing in that month.

---

<div class="post-metadata">

**Author:** ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)\
**Post date:** [November 14, 2020, 4:29pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/16 "2020-11-14T16:29:14Z")

</div>

Thank you, that helps me understand what you are trying to do.

In my example above, you will need to create 3 functions:  
Are There Tests

- Loop through the local data source
- If the year in the datasource = YEAR variable AND month in the data source = MONTH variable, then return true, else, return false

Insert Test Results

- Loop through the local data source
- If the year in the datasource = YEAR variable AND month in the data source = MONTH variable
- Copy the contents of the raw scores into the “New” datasource

Insert Zeros

- Insert a row in the “new” data source using the Year and Month variable values and zeros for all of the scores

I don’t use local data sources, so you will need to come up with the blocks get and set cell values.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:21pm UTC](https://community.thunkable.com/t/create-a-monthly-scoreboard-with-empty-months-filled/958389/17 "2024-11-08T12:21:39Z")

</div>


