web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

Gallery method for checkbox mapping to SP columns?

(0) ShareShare
ReportReport
Posted on by 6
I have a generic SP list with columns Date, Instrument, Task1, Task2, Task3, Task4, Task5, Task6. For each instrument value (instrument1, instrument2, instrument3) there is a date created via Power Automate that then creates a blank row for that instrument and date with all the tasks set to "no". Each of my instruments have different task names, hence why I left the column generic. I'm trying to find a gallery checkbox method that allows me to dynamically name the checkbox, return values of that row as "yes" or "no", and patch that record for any updates with an external button. 
 
Upon switching instruments, the names, column values should dynamically change with the name I've created in my custom gallery. I'm just not sure how to approach mapping each Task column to the checkbox. I had thought that: 
 
I have thought that something like this would have worked, but doesn't:
 
Switch(
TabList3_2.Selected.Value,
"Sciex X500 QToF",
[
{Name: "Check Solvent Levels", Map: "Task1"},
{Name: "Check Waste Levels", Map: "Task2"},
{Name: "Check Oil Level", Map: "Task3"},
{Name: "Clean Curtain Plate", Map: "Task4"},
{Name: "Purge Solvent/Rinse", Map: "Task5"},
{Name: "Check Tune ToF", Map: "Task6"},
{Name: "Restart Computer", Map: "Task7"},
{Name: "Task8", Map: "Task8"},
{Name: "IntegerVal1", Map: "Task9"},
{Name: "IntegerVal2", Map: "Task10"}
],
[]
)
);
Categories:
I have the same question (0)
  • Suggested answer
    Jerry-IN Profile Picture
    286 on at
    Gallery method for checkbox mapping to SP columns?
    Hello   
     
    Thanks for raising this question. Power Apps doesn't allow dynamic column names like {ThisItem.Col: "Yes"} in Patch records, so use Switch statements on your config table's Col field to explicitly map labels to Task1-Task6 columns—this handles both checkbox Defaults (to load "Yes"/"No" states) and updates (via OnChange or external button) perfectly for your instrument-specific tasks.​

    Your gallery Items Switch table is spot-on; just tweak "Map" to "Col" and add a Label control per item for dynamic names (e.g., Label.Text = ThisItem.Label). For the checkbox Default, use this formula (replacing "YourSPList" with your data source and assuming a DatePicker1 for the row filter):
     
    Switch(
      ThisItem.Col,
      "Task1", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task1) = "Yes",
      "Task2", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task2) = "Yes",
      "Task3", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task3) = "Yes",
      "Task4", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task4) = "Yes",
      "Task5", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task5) = "Yes",
      "Task6", LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value, Task6) = "Yes",
      false
    )
     
    This pulls the current row's value dynamically without delegation issues for small lists.​
    For real-time updates, drop this into each checkbox's OnChange (sets a row var first for reuse):
     
    Set(varRow, LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value));
    Patch(
      YourSPList,
      varRow,
      Switch(
        ThisItem.Col,
        "Task1", {Task1: If(Self.Value, "Yes", "No")},
        "Task2", {Task2: If(Self.Value, "Yes", "No")},
        "Task3", {Task3: If(Self.Value, "Yes", "No")},
        "Task4", {Task4: If(Self.Value, "Yes", "No")},
        "Task5", {Task5: If(Self.Value, "Yes", "No")},
        "Task6", {Task6: If(Self.Value, "Yes", "No")}
      )
    )
     
    Pro tip: On instrument/date change, Reset the gallery and checkboxes to refresh states.​
    Finally, for your external "Submit" button's OnSelect (bulk-safe, idempotent):
     
    ForAll(
      Gallery1.AllItems,
      Patch(
        LookUp(YourSPList, Date = DatePicker1.SelectedDate && Instrument = TabList3_2.Selected.Value),
        Switch(
          ThisItem.Col,
          "Task1", {Task1: If(ThisItem.Checkbox1.Value, "Yes", "No")},  // Checkbox1 = gallery template name
          "Task2", {Task2: If(ThisItem.Checkbox1.Value, "Yes", "No")},
          // ...repeat for Task3-6
          "Task6", {Task6: If(ThisItem.Checkbox1.Value, "Yes", "No")}
        )
      )
    );
    Notify("Daily tasks updated for " & TabList3_2.Selected.Value, NotificationType.Success)
     
    This setup scales to your other instruments just expand the Switch tables/cases. For bigger lists, collect pending changes into a temp collection and Patch once at submit to avoid multiples. Test delegation with >500 rows via a varRow Set.​

    If helpful, please accept the answer and help the community.
     
    Best Regards,
    Jerald Felix

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 58

#2
Fubar Profile Picture

Fubar 46 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard