DropDown data shuffling issue

Hi All,
Good day.

I am trying to develop a roster for my team in Microsoft Power Apps. We are 6 teammates which do the duty in following format.
SUMMERS:
6A, 6B, 11A, 11B, 12A, 12B

WINTERS:
7A, 7B, 11A, 11B, 1A, 1B.

Please note that in every shift there are two persons so we use A and B for each person. This is just to identify which person from which shift will be working from home and who will be working from office. The A and B decides that.

If a person is doing a shift of 6A this week, then he will have the following format next weeks. 6A -> 11A -> 12A ->6B ->11B ->12B OR 7A ->11A -> 1A ->7B ->11B ->1B

11A will have Friday Off and Sunday on as 8A.

What I have achieves so far is that I can select start date from DatePicker1 and end date from DatePicker2. Select Time slots from DropDown lists Dd1 to Dd6) and then data table Dt1 shows that time against 6 agents like
Values of Dd1 against Agent1, Dd2 against Agent2 and so on till Vale of Dd6 against Agnet6.
The table format is shown in the image attached.

I am having problem that how I can achieve the shuffling which I described above?
For example I have 30 days roster, Then how I will achieve that my table can select and show values from the DropDown lists for the first week only and then shuffles the next 3 weeks as the logic shared above.

The code I used.

// Step 1: Set the start date and end date
Set(startDate, DatePicker1.SelectedDate);
Set(endDate, DatePicker2.SelectedDate);

// Step 2: Calculate the date range between startDate and endDate
ClearCollect(
    RosterData,
    { AgentName: Label1.Text, ShiftTiming: Text(Dd1.Selected.Value) },
    { AgentName: Label2.Text, ShiftTiming: Text(Dd2.Selected.Value) },
    { AgentName: Label3.Text, ShiftTiming: Text(Dd3.Selected.Value) },
    { AgentName: Label4.Text, ShiftTiming: Text(Dd4.Selected.Value) },
    { AgentName: Label5.Text, ShiftTiming: Text(Dd5.Selected.Value) },
    { AgentName: Label6.Text, ShiftTiming: Text(Dd6.Selected.Value) }
);

ClearCollect(
    DateRange,
    AddColumns(
        Filter(
            AddColumns(
                Sequence(
                    DateDiff(startDate, endDate) + 1
                ),
                Date, DateAdd(startDate - 1, Value) 
            ),
            Weekday(Date, StartOfWeek.Monday) >= 1,  // Include all days of the week
            Weekday(Date, StartOfWeek.Monday) <= 7   // Include all days of the week
        ),
        Day, Text(Date, "[$-en-US]ddd")
    )
);

// Step 3: Generate the monthly roster
ClearCollect(
    MonthlyRoster,
    AddColumns(
        DateRange,
        Agent1,
        If(
            Dd1.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd1.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd1.Selected.Value)
            )
        ),
        Agent2,
        If(
            Dd2.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd2.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd2.Selected.Value)
            )
        ),
        Agent3,
        If(
            Dd3.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd3.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd3.Selected.Value)
            )
        ),
        Agent4,
        If(
            Dd4.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd4.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd4.Selected.Value)
            )
        ),
        Agent5,
        If(
            Dd5.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd5.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd5.Selected.Value)
            )
        ),
        Agent6,
        If(
            Dd6.Selected.Value = "11A" && Day = "Fri", "Off",
            If(
                Dd6.Selected.Value = "11A" && Day = "Sun", "8A",
                If(Day = "Sat" || Day = "Sun", "Off", Dd6.Selected.Value)
            )
        )
    )
);

// Step 4: Refresh the Data Table by reassigning the updated collection
// DT1.Items = MonthlyRoster;

BR.
AK.

Auto population in comboBoxes in CSharp

I am preparing a CSharp based desktop app in VS 2019. I have 4 ComboBoxes. On the form load, the comboBox1 fetches folder names in root directory in D drive. The structure is Folder The sub folder Then sub folder then MS word documents in the 4th folder. For example, Windows- -> IT ->Print-> MS word document. What I am looking for is when I click on the folder name in comboBox1, the sub folder in the D drive in that folder should automatically populated. I am facing 2 problems.

Folder are fetching in comboBox1 and the sub folders are automatically fetching in comboBox2. But when I select any folder in comboBox2, nothing is happening in comboBox 3. 2nd problem is that, If I select any folder in comboBox1, I can see sub-folders in comboBox2, but when I change the folder name in comboBox1, i can still see the previous sub-folder in comboBox2. I need it the changes to take affect on run-time. What I have tried so far is

namespace ITSDClnt 
     public partial class Form1 : Form { private string rootFolderPath = @"D:\ITSD-Test"; // Replace with your D drive path

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        PopulateComboBox(comboBox1, rootFolderPath);
    }

    private void PopulateComboBox(ComboBox comboBox, string folderPath)
    {
        if (Directory.Exists(folderPath))
        {
            string[] subdirectories = Directory.GetDirectories(folderPath);
            comboBox.Items.Clear();
            comboBox.Items.AddRange(subdirectories.Select(Path.GetFileName).ToArray());
        }
        else
        {
            MessageBox.Show("The specified directory does not exist.");
        }
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        comboBox2.Items.Clear();
        comboBox3.Items.Clear();
        comboBox4.Items.Clear();

        string selectedFolderName = comboBox1.SelectedItem?.ToString();
        if (!string.IsNullOrEmpty(selectedFolderName))
        {
            string selectedFolderPath1 = Path.Combine(rootFolderPath, selectedFolderName);
            PopulateComboBox(comboBox2, selectedFolderPath1);
        }
    }

    private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
    {
        comboBox3.Items.Clear();
        comboBox4.Items.Clear();

        string selectedFolderName = comboBox2.SelectedItem?.ToString();
        if (!string.IsNullOrEmpty(selectedFolderName))
        {
            string selectedFolderPath2 = Path.Combine(rootFolderPath, comboBox1.SelectedItem.ToString(), selectedFolderName);
            PopulateComboBox(comboBox3, selectedFolderPath2);
        }
    }

    private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
    {
        comboBox4.Items.Clear();

        string selectedFolderName = comboBox3.SelectedItem?.ToString();
        if (!string.IsNullOrEmpty(selectedFolderName))
        {
            string selectedFolderPath3 = Path.Combine(rootFolderPath, comboBox1.SelectedItem.ToString(), comboBox2.SelectedItem.ToString(), selectedFolderName);
            PopulateFilesComboBox(selectedFolderPath3);
        }
    }

    private void PopulateFilesComboBox(string folderPath)
    {
        if (Directory.Exists(folderPath))
        {
            string[] files = Directory.GetFiles(folderPath, "*.docx");
            comboBox4.Items.Clear();
            comboBox4.Items.AddRange(files.Select(Path.GetFileName).ToArray());
        }
        else
        {
            MessageBox.Show("The specified folder does not exist.");
        }
    }

    private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
    {
        string selectedFileName = comboBox4.SelectedItem?.ToString();
        if (!string.IsNullOrEmpty(selectedFileName))
        {
            string selectedFolderPath3 = Path.Combine(rootFolderPath, comboBox1.SelectedItem.ToString(), comboBox2.SelectedItem.ToString(), comboBox3.SelectedItem.ToString());
            string filePath = Path.Combine(selectedFolderPath3, selectedFileName);

            if (File.Exists(filePath))
            {
                string fileContent = File.ReadAllText(filePath);
                richTextBox1.Text = fileContent;
            }
            else
            {
                MessageBox.Show("The selected file does not exist.");
            }
        }
    }
}
}