Prepopulated data in database

Hi, I have a requirement where I have to set a prepopulated data like thought for the day/month, and each day/month it will be populated from the database to the site automatically.How to achieve this in mendix?
2 answers


The title for the thread is little misleading however for your case, you can try the following.

1. Create an Entity in your domain model named "Thoughts". Attributes - DisplayDate(DateTime type), Message(String type)

2. Now you can create objects of this new entity from the front-end by creating DataGrid, New/Edit pages and add the data. Have this functionality hidden from Users but only to Admin.

3. In the User's page add a DataView with source as Microflow. Retrieve the "Thoughts" object (not list but "first") with xpath [DisplayDate = '[%BeginOfCurrentDay%]']


Hope this helps.


Make a microflow where you do all the create actions. Create a date variable where you begin for example with dateTimeUTC(2018,1,1). Create your object and set it with that variable. Then use the addDays function to add one day to the variable to create the next object. Use a loop for that where you check if the year is still 2018. This way you can create a year entity that holds all the days of that year.




You might also check this module: