29
Views
5
Comments
Solved
Showing months not inserted in the database

I'm trying to do a employee of the month Reactive Web App. I want to be able to see the history of the employees of the past years. I'm trying to show all the 12 months in a list where I grab all the results from a specific year, if the month is not in the list is suppose to show a gray container.  But if I have in the database only information about september and october how can I add the other months? 

Currently I'm trying to iterate the list of the available months in the database and using 'if' conditions to make a grey container if the month is not in that list but it isn't working. Can someone help me?

Thank you :)

Solution

I think you should create a Frond-End Structure to combine different datasets.

 it's a standard practice to set up a front-end structure that allows you to merge multiple datasets into a unified table.

Hi,

You can add data in the DB buy using add row property in the entity

1. Click on the add row button and add data one by one in the entity and apply.

And secondly in the if condition what is the condition you are using can you share its easy to help you out.

Thanks

Ruchi

Solution

I think you should create a Frond-End Structure to combine different datasets.

 it's a standard practice to set up a front-end structure that allows you to merge multiple datasets into a unified table.

Hello Ines,

If you have existing database and now you just want to update the months, then yes you can create a screen where you can update the months in existing database, Scaffolding will help you here to create the database.

Hope this helps,

Komal

Agreed that if you are going to be using this for multiple individuals at once, and not as a 'one off' type screen for an individual, it would be best to build a pre-populated month+year database scaffold. This would speed up loadtime in the future and allow you to always load an expected structure, regardless of rather or not data exists for that user for that month/year.

Hello Inês,

If I understood correctly you want to show a list of the employee of the months.

If you have a month without information, you want to show an empty grey container.

Let's imagine that you want to show information about 2022 and you only have information, for instance, for September and October.

 I would suggest that after getting data from your source (on afterfetch event, for instance), you create a new list to show on front-end, then do an ad-hoc loop to run from 1 (jan) to 12 (dec). Then, if the month is on the source list, you addir to your new list. If it is not, you add an empty entry.

Then, on front end you iterate thorough this new list and check if it is an empty entry or not (you can also have an extra bool with that information for each record). 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.