🚨 Summary of Issue
I'm building a PowerApps application for teachers to assess student performance. The goal is to:
✅ Allow teachers to select a rating for each question using a dropdown menu
✅ Dynamically update the correct "MyRatingX" field inside colStudentScores
✅ Ensure the update is mapped to the correct question
✅ Submit all ratings to a SharePoint list
⚠️ Main Problem: PowerApps does not support dynamic field names inside Patch() when trying to update { "MyRating" & Number: Value }. I’ve tried multiple workarounds, but none seem to work.
🛠️ What I’ve Already Tried
I've collaborated extensively with GPT-4 and Claude AI to troubleshoot this issue. While they've provided valuable insights, PowerApps' limitations on dynamic field names in Patch() have made it challenging to find a scalable solution.
📌 Need Help With:
- Dynamically updating a specific "MyRatingX" column based on a question number
- Handling PowerApps' limitation of
{ FieldName: Value }inPatch() - Ensuring correct type handling when using
Switch()orIf()to updateMyRatingX - Best way to submit the final scores to a SharePoint list
🛠️ App Overview & Workflow
The app involves two main screens:
📌 Screen 1 - Selecting Assessment Content
- Teachers pick question categories and descriptors
- This filters available questions for Screen 2
- Selected questions are stored in
colAssessmentQuestions
📌 Screen 2 - Answering Questions & Storing Scores
- Teachers assign ratings using
Dropdown8(values:-1, 0, 1, 2, 3, 4, 5) - The app needs to store the selected answer inside
colStudentScores - Each question maps to a "MyRatingX" field, where
Xis the question number - Once all ratings are completed, the data is submitted to a SharePoint list
📋 Collections & Controls
🔹 colAssessmentQuestions (Holds Questions & Ratings)
| Field Name | Description |
|---|---|
Code |
Question identifier |
Descriptor |
Question description |
QuestionNumbersList |
Comma-separated list of question numbers (e.g., "1,2,3") |
MyRatingsList |
Stores selected ratings |
🔹 colStudentScores (Holds Student Scores Before Submission)
| Field Name | Description |
|---|---|
StudentID |
Unique student identifier |
StudentName |
Name of the student |
Class |
Student's class |
Code |
Question code |
Descriptor |
Question description |
MyRating1 - MyRating20 |
Holds student’s rating for each question |
**🔹 Dropdown8 (Rating Selector - OnChange Event Triggers Patch())
- Values:
-1, 0, 1, 2, 3, 4, 5 - Stores the selected rating for a question
🔹 gal_StudentScores (Displays Student Scores)
- Shows scores from
colStudentScores - OnChange of
Dropdown8should update the respectiveMyRatingXcolumn dynamically
❌ What I’ve Tried (Failed Fixes)
1️⃣ Using { FieldName: "MyRating" & Number }
- PowerApps does not resolve
FieldNamedynamically inside{ FieldName: Value }
2️⃣ Wrapping { FieldName, Value } inside Table()
- PowerApps still does NOT interpret
FieldNameas a column
3️⃣ Using PatchRecord()
- PowerApps does NOT recognize
PatchRecord()as a valid function
🚨 Current Code Attempt (With Errors)
// ✅ Correctly Update the correct MyRatingX field inside colStudentScores
Patch(
colStudentScores,
LookUp(colStudentScores, StudentID = gal_StudentScores.Selected.StudentID),
{
"MyRating" & Text(First(Split(ThisItem.QuestionNumbersList, ",")).Result, "00"):
If(Dropdown8.Selected.Value = -1, Blank(), Dropdown8.Selected.Value)
}
);
🔻 Current Errors:
- "MyRating" & Text(...) → Unexpected characters in
Patch() - PowerApps does NOT allow dynamic field names inside
{} Split(ThisItem.QuestionNumbersList, ",")→"Result"isn't recognized- Incorrect format specifier for
"0"inText()function
🔧 Alternative Approaches (Partial Fixes)
✅ Option 1 - Using Switch() Instead of Dynamic Fields
Patch(
colStudentScores,
LookUp(colStudentScores, StudentID = gal_StudentScores.Selected.StudentID),
Switch(
Value(First(Split(ThisItem.QuestionNumbersList, ","))),
1, {MyRating1: If(Dropdown8.Selected.Value = -1, Blank(), Dropdown8.Selected.Value)},
2, {MyRating2: If(Dropdown8.Selected.Value = -1, Blank(), Dropdown8.Selected.Value)},
3, {MyRating3: If(Dropdown8.Selected.Value = -1, Blank(), Dropdown8.Selected.Value)},
// Continue for all 20 rating fields...
20, {MyRating20: If(Dropdown8.Selected.Value = -1, Blank(), Dropdown8.Selected.Value)}
)
);
✅ Pros:
- Works within PowerApps' limitations
- Avoids trying to use dynamic column names
❌ Cons:
- Inefficient (Requires explicitly writing all 20 cases)
✅ Option 2 - Using With() & If() Instead of Switch()
With(
{ questionNumText: First(Split(ThisItem.QuestionNumbersList, ",")) },
Patch(
colStudentScores,
LookUp(colStudentScores, StudentID = gal_StudentScores.Selected.StudentID),
If(questionNumText = "1", {MyRating1: Dropdown8.Selected.Value},
If(questionNumText = "2", {MyRating2: Dropdown8.Selected.Value},
If(questionNumText = "3", {MyRating3: Dropdown8.Selected.Value},
// Continue for all 20 MyRating fields...
If(questionNumText = "20", {MyRating20: Dropdown8.Selected.Value}, {})))))))))))))))))))
)
);
✅ Pros:
- More readable than
Switch() - Handles missing values correctly
❌ Cons:
- Still requires explicitly writing all 20 cases
🔹 Key Issues & Request for Help
- Is there a better way to update the correct
MyRatingXcolumn dynamically? - What is the best PowerApps-friendly approach to work around
{ FieldName: Value }? - How do I ensure correct type handling (Text vs. Number vs. Record) when using
Switch()orIf()? - What’s the best way to submit this data to a SharePoint list while keeping it structured?
I’ve hit a roadblock and would appreciate any insights from the PowerApps experts in this community. If needed, I can provide screenshots and more details! 🚀

Report
All responses (
Answers (