Gallery has a Slider for scoring and associated Comments field for 13 survey questions however the Comments field for each of the 13 survey questions is not holding the last comment when the user scrolls away from the focus screen area. Previous Comments are held. Just not the last one.
FieldTeamSurvey.OnVisible:
// Build question collection with numeric Score column
If(
IsEmpty(colResponses),
ClearCollect(
colResponses,
ForAll(
Filter('C&OAnalysisQuestionDim', Role = "Field Team"),
{
QuestionNum: ThisRecord.QuestionNum,
QuestionID: ThisRecord.Title, // Title from QuestionsDim = QFTxx
Question: ThisRecord.Question,
Score: 0, // numeric default
Comments: "" // Stored committed comments
}
)
)
)
FieldTeamSurvey GalleryFT Items:
colResponses
FieldTeamSurvey GalleryFT txtComment Default:
ThisItem.Comments
FieldTeamSurvey GalleryFT txtComment DelayOutput:
true
FieldTeamSurvey GalleryFT txtComment OnChange:
Patch(colResponses, ThisItem, { Comments: Self.Text })
FieldTeamSurvey GalleryFT sldScore Default:
ThisItem.Score
FieldTeamSurvey GalleryFT sldScore OnChange:
Patch(colResponses, ThisItem, { Score: sldScore.Value })
FieldTeamSurvey.IconAccept1_1.OnSelect:
If(
CountIf(colResponses, Score = 0) > 0,
Notify("Please complete all survey questions before submitting.", NotificationType.Error),
// Commit any on-screen text into colResponses
ForAll(
GalleryFT.AllItems,
UpdateIf(
colResponses,
QuestionNum = ThisRecord.QuestionNum,
{
Comments: txtComment.Text,
Score: Value(sldScore.Value)
}
)
);
// Create the full SharePoint record and capture it
Set(
varSavedRecord,
Patch(
'C&O Analysis Survey Field Team',
Defaults('C&O Analysis Survey Field Team'),
{
ResponseID: GUID(),
ResponseGroupID: varResponseGroupID,
Role: { Value: "Field Team" },
// Metadata
Survey_x0020_Date: varFieldMeta.Survey_x0020_Date,
Reviewer: varFieldMeta.Reviewer,
Respondent: varFieldMeta.Respondent,
Region: varFieldMeta.Region,
Location: varFieldMeta.Location,
Regional_x0020_Manager: varFieldMeta.Regional_x0020_Manager,
Department: varFieldMeta.Department,
Department_x0020_Number: varFieldMeta.Department_x0020_Number,
Project: varFieldMeta.Project,
Project_x0020_Number: varFieldMeta.Project_x0020_Number,
Leader_x0020_Name: varFieldMeta.Leader_x0020_Name,
Leader_x0020_Position: varFieldMeta.Leader_x0020_Position,
Frontline_x0020_Leader_x0020_Nam: varFieldMeta.Frontline_x0020_Leader_x0020_Nam,
Frontline_x0020_Leader_x0020_Pos: varFieldMeta.Frontline_x0020_Leader_x0020_Pos,
Field_x0020_Person: varFieldMeta.Field_x0020_Person,
// Answers
Q01: { Value: Text(LookUp(colResponses, QuestionNum="Q01", Score)) },
'Q01 Comments': LookUp(colResponses, QuestionNum="Q01", Comments),
Q02: { Value: Text(LookUp(colResponses, QuestionNum="Q02", Score)) },
'Q02 Comments': LookUp(colResponses, QuestionNum="Q02", Comments),
Q03: { Value: Text(LookUp(colResponses, QuestionNum="Q03", Score)) },
'Q03 Comments': LookUp(colResponses, QuestionNum="Q03", Comments),
Q04: { Value: Text(LookUp(colResponses, QuestionNum="Q04", Score)) },
'Q04 Comments': LookUp(colResponses, QuestionNum="Q04", Comments),
Q05: { Value: Text(LookUp(colResponses, QuestionNum="Q05", Score)) },
'Q05 Comments': LookUp(colResponses, QuestionNum="Q05", Comments),
Q06: { Value: Text(LookUp(colResponses, QuestionNum="Q06", Score)) },
'Q06 Comments': LookUp(colResponses, QuestionNum="Q06", Comments),
Q07: { Value: Text(LookUp(colResponses, QuestionNum="Q07", Score)) },
'Q07 Comments': LookUp(colResponses, QuestionNum="Q07", Comments),
Q08: { Value: Text(LookUp(colResponses, QuestionNum="Q08", Score)) },
'Q08 Comments': LookUp(colResponses, QuestionNum="Q08", Comments),
Q09: { Value: Text(LookUp(colResponses, QuestionNum="Q09", Score)) },
'Q09 Comments': LookUp(colResponses, QuestionNum="Q09", Comments),
Q10: { Value: Text(LookUp(colResponses, QuestionNum="Q10", Score)) },
'Q10 Comments': LookUp(colResponses, QuestionNum="Q10", Comments),
Q11: { Value: Text(LookUp(colResponses, QuestionNum="Q11", Score)) },
'Q11 Comments': LookUp(colResponses, QuestionNum="Q11", Comments),
Q12: { Value: Text(LookUp(colResponses, QuestionNum="Q12", Score)) },
'Q12 Comments': LookUp(colResponses, QuestionNum="Q12", Comments),
Q13: { Value: Text(LookUp(colResponses, QuestionNum="Q13", Score)) },
'Q13 Comments': LookUp(colResponses, QuestionNum="Q13", Comments),
Follow_x002d_up_x0020_Action: varFollowUpAction,
Comments: varGeneralComments
}
)
)
);
// Navigate to the attachments screen
Navigate(FieldTeamAttachmentScreen, ScreenTransition.Fade)