Day as option with week offset, filter results in rg to get date

Hi! First, (if any) then let me apologize for any bad translations in this post.
I am trying to build a resource scheduling system and have encountered a challenge i just cant figure out. In my app i want to let the user set a template for creating shifts, so if the user creates a template that is for a given number of weeks with specified time ranges and employees, they can use this template to create shifts for a set date range . The data is stored in data types Shift template and Shift template time ranges, and everything is connected fine. My problem is when getting this data into dates since i have days as options. Each option is made for 4 weeks and contains attributes day as number (0-6) and week offset (number 1-4) total 28 options. So the problem comes when trying to extract this and put it into dates. I have an expression like this (Picture) where they sort fine in regards to day as number but how can i sort with the additional week attribute so the unique days sort to the correct week?

Hope anyone smarter then me can help because i think i am blind to the solution from looking at this too long.

This topic was automatically closed after 70 days. New replies are no longer allowed.