Dynamic list of week ending dates

Dynamic list of week ending dates

  

Hi - I am new to Outsystems and still getting use to the system (done some of the step by step mobile app courses but still very much learning). I am trying to work out the best way to show a list of week endings for a timesheet app. Basically the data needs to dynamically list a number of dates between the start date set for a person and the week ending after today's date.

I have worked out how to do it for one date - eg using DayofWeek(StartDate) & AddDays() to work out the first week ending date but can't see how I would create a list of these week ending dates for the period of time between the first week ending and the week ending after today's date (and not further than that).

In 'creating' these week endings - it is possible that a person will finish their job in one week and therefore not need the two dates (ie the first & second week ending) - so ideally I want to create them as a list of potential values rather than create them as values stored in the Entity.

From the list the user would then click on the relevant week ending to enter their hours - ie using the week ending value selected in the next screen.

Any help/suggestions would be greatly appreciated! 


Solution

Hi Declan.

You can create a variable on the screen, named DateList. By using that name, OutSystems will infer the type to be a list of Date. You can achieve the same effect with other variable names by changing the Data Type, but the way I described is the easiest way for you to start.

Then, on the preparation, you can build the list by repeatedly using the ListAppend action (you can find this action in the System module, or you can just use CTRL-G and search for it).

Because in OutSystems there's no while loop, you will have to use an if node to detect the end of the loop. Here's a sample of how to do that:

Solution

leonardo.fernandes wrote:

Hi Declan.

You can create a variable on the screen, named DateList. By using that name, OutSystems will infer the type to be a list of Date. You can achieve the same effect with other variable names by changing the Data Type, but the way I described is the easiest way for you to start.

Then, on the preparation, you can build the list by repeatedly using the ListAppend action (you can find this action in the System module, or you can just use CTRL-G and search for it).

Because in OutSystems there's no while loop, you will have to use an if node to detect the end of the loop. Here's a sample of how to do that:

Thanks!