Implementing Time-Based Greeting Messages in Mendix

0
m working on implementing a greeting message in my Mendix application based on the current time of day. I want to display 'Good morning' if it's before noon, 'Good afternoon' if it's between noon and 6 PM, and 'Good evening' for the rest of the day. How can I achieve this using Mendix in decision activity?  
asked
1 answers
1

Because the value does not have to be stored, I would recommend using a non persitable entity (called Message) where you add a String attribute called MessageText.

On the homepage (or in the layout) you want to add a dataview based on a DataSource microflow. In the microflow you can retrieve the current account for the current user and create a integer Variable. In the Variable you want to capture the hour portion of the currentdatetime. For this you need to use two parse functions to achieve this. See this example and this and it would be something like parseInteger(formatDateTime([%CurrentDateTime%],'HH')).

Next activity would be to Create the Message object and set the Message Text with an if then else statement like if $Variable < 12 then 'Good morning '+$Account/FullName else if $Variable < 18 then 'Good afternoon '+$Account/FullName else 'Good evening '+$Account/FullName

The Message object will be the output of you microflow.

Hope this will point you in the right direction

 

answered