Hello everybody, I have a gallery in Power Apps that serves as a checklist and I have all the questions on them as required fields that need to be answered for the checklist to be submitted, the problem is that when the app first runs and it goes to the checklist, if they hit submit it gets uploaded (even with the required field), however when they DO submit it, then the required fields kick in and start working, how do I make it so that it starts from the first try?
Just did!
Please post a new question for this one as it related to a new problem and I will take a look.
If you like my responses, please give it a Thumbs Up.
Thank you, this worked! Hopefully you can help me a little on the next problem that I have:
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 the filled the comment box next to the question with anything other than blank, hopefully you can help me on this, thank you!
@Angel5 Thank you for your response.
Based on the code you need to change the setup:
If(
'Review Purpose'.Selected.Value="Review purpose", Notify("Select the Review Purpose."),
'Project Site Box'.Text="", Notify("Select 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."),
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","2",Answers.Selected.Value="Not passed","1",Answers.Selected.Value="N/A","0")
}
));
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)
)
You need one If then the last else will execute the Submit if all the checks are false.
Yeah but I want the gallery to be submitted when all these checks are NOT met, since it would mean that the user put something in the required fields, so when these fields are filled, then the submit happens, here is my code on how I achieved this:
If(If('Review Purpose'.Selected.Value="Review purpose",Notify("Select the Review Purpose."),
'Project Site Box'.Text="",Notify("Select 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."))=ProcessCompleted=false,
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","2",Answers.Selected.Value="Not passed","1",Answers.Selected.Value="N/A","0")
}
));
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))
This works, but it only works when the user hits the submit button for the first time since the app ran, it defeats the whole purpose of these being required fields if on their first run of the app they're able to hit submit without any fields filled, please let me know for an answer on how to get it going on app start!
Hello @Angel5 ,
Is the order of your code in your Submit button set in the correct sequence?
Based on your previous post and the information I have now it would like this:
If(
ReviewpurposeDropdown_13.Selected.Value="Review purpose",
Notify("Select the Review Purpose."),
TextInput1_3.Text="",
Notify("Select the Project Site."),
InputDrawing_13.Text="",
Notify("Input the Drawing Numbers."),
TextInput1_1.Text="",
Notify("Input the Project Number."),
!IsEmpty(Filter(Gallery.AllItems, GalleryDropdown1_2.Selected.Value="")),
Notify("Enter an answer for all questions."),
SubmitForm(<FormName>)
)
If all checks have been performed then only the Submit will be executed.
Please let me know if this worked for you.
------------------------------------------------------------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.
If you like my response, please give it a Thumbs Up.
Still haven't found the solution, please let me know!
WarrenBelz
146,776
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional