Hello everyone! This is the code:
If(
'Review Purpose'.Selected.Value="Review purpose", Notify("Select the Review Purpose."),
'Project Site Box'.Text="", Notify("Input the Project Site."),
InputDrawing.Text="", Notify("Input the Drawing Numbers."),
'Project Number'.Text="", Notify("Input the Project Number."),
!IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="")), Notify("Enter an answer for all questions."),
!IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Passed with comments")), Notify("Enter comment on answers Passed with comments."),
!IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value="Not Passed")), Notify("Enter comment on answers Not passed."),
Set(LabelVisible,true);
ForAll('OneLine Gal'.AllItems, Patch('Power App Data Store', Defaults('Power App Data Store'), //The for all selects all the items in the gallery, the patch function is to upload the fiels to their columns
{
'Unique ID':'Project Number'.Text & "-" & InputDrawing.Text & "-" & DocTitleBox.Text,
Title:Label3.Text,
'Project Site':'Project Site Box'.Text,
'Project Number':'Project Number'.Text,
'Drawing#':InputDrawing.Text,
'Review Purpose': 'Review Purpose'.Selected.Value,
'Document Title':DocTitleBox.Text,
'Document Number':DocNumberBox.Text,
Department:DepartmentBox.Text,
'Question Number':'Question Numbers'.Text,
'Checklist Questions':'Checklist Questions'.Text,
Answers:Answers.Selected.Value,
Comments:Comments.Text,
'Additional Comments':'Additional Comments'.Text,
Score: If(Answers.Selected.Value="Passed","3",Answers.Selected.Value="Passed with comments","1",Answers.Selected.Value="Not passed","0",Answers.Selected.Value="N/A","")
}
));
Office365Outlook.SendEmailV2(
User().Email,
"One Line Checklist", //Subject of the email
"PDF Generated by Power App", //Content of the email
{
Attachments: Table(
{
Name: "OneLineCheck.pdf", //Name of the pdf generated
ContentBytes: PDF( //Calls the pdf Function
'Container 1',
{ExpandContainers: true}
)
}
)
}
);
Set(ProcessCompleted,true);
Set(LabelVisible,false)
)
For when they pick Not passed or Passed with comments on the dropdown, I want them to fill the comment box next to the question, so the notification shouldn't appear if they filled the comment box next to the question with anything other than blank, hopefully someone can help me on this, thank you!
This worked partially, when they choose "Not Passed" or "Passed with comments" the submit button doesn't do anything if the comment box is also empty, it does submit when they fill the comment box, however I want the app to notify them to fill the comment box, otherwise they're going to hit submit and nothing will happen and they might get confused on why nothing occured.
To achieve this, you can update your existing code to include additional conditions before showing notifications. Here's a modified version of your code:
If(
'Review Purpose'.Selected.Value = "Review purpose", Notify("Select the Review Purpose."),
IsBlank('Project Site Box'.Text), Notify("Input the Project Site."),
IsBlank(InputDrawing.Text), Notify("Input the Drawing Numbers."),
IsBlank('Project Number'.Text), Notify("Input the Project Number."),
!IsEmpty(Filter('OneLine Gal'.AllItems, Answers.Selected.Value = "")), Notify("Enter an answer for all questions."),
IsEmpty(
Filter('OneLine Gal'.AllItems,
(Answers.Selected.Value = "Passed with comments" || Answers.Selected.Value = "Not Passed") && IsBlank(Comments.Text)
)
),
Set(LabelVisible, true);
// Rest of your code
)
In this version of your code, the condition IsEmpty(...) checks whether the user selected "Passed with comments" or "Not Passed" and if the corresponding comment box (in this case, the Comments field) is blank. If the comment box is not blank, the condition will evaluate as false, and the notification won't be triggered.
This way, the notification will only appear if the user selects "Not Passed" or "Passed with comments" and leaves the corresponding comment box empty. If they enter comments, the notification will be skipped. Make sure you adapt this logic according to your field names and requirements.
If this helped and resolves your issue can you leave a thumbs up and mark this as the solution?
Many Thanks
Andrew
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional