@Markus_R Hopefully I got your need right. Find below a screenvideo of the functioning solution and also a bunch of screenshots to help you get going. I am sure, that this solution still could be further improved and optimized, but as a start it can help. (oh, yeah, just ignore the other pages in the preview app, this is my tester app…)
As for the layout:
Container > Row > 1 Cell > Text, Text.
This 1 Cell is repeated with a page variable in my case named “weekdays”:
The variable “today” is there to be able to set different “reset points” but for this example it is just equal to NOW().
In order to populate the weekdays part on page mounted event we have the following logic:
The set vairable of weekdays part is the following:
Yes-yes, I manually added the weekday names and the index of theirs according to the FORMAT_DATETIME_LOCAL(date, “E”) formula.
The “day_date” property is created with the following formula:
ADD_DURATION(pageVars.today, (1-NUMBER(FORMAT_DATETIME_LOCAL(pageVars.today, "E"))), "days")
Where the number before the “-” sign is adjusted for each day. Just add 1 at each day… So Sunday should be 7-NUMBER…
Now at the bottom of the screen we have the previous week and the next week buttons and also the reset button. Logic for the “previous week” is a “component tap” > “set page variable”:
The mapping helps to keep the change simple. The “day_date” formula is the following:
SUBTRACT_DURATION(source.item.day_date, 1, "weeks")
The “next week” button is the same, just change “SUBTRACT” to “ADD”
Finally the reset button. I just copy + pasted the logic flows after the “page mounted” event that have already been described above.