So I have to make a lunch app in PowerApps, the app is created from a Sharepoint list.
Now there are some time restrictions I have to deal with, so this is the case:
-The employees can order a sandwich before 9:45 AM the same day and;
-The rest of the day they can order for any other day of the year
So I assume I have to do the check on the OnSelect of the Submit button but I can't really figure out the exact formula to get it right.
Anyone have other ideas? Please let me know because this is a crucial part of the app. All help will be appreciated.
This is what I tried: If(DataCardValue6 < TimeValue("9:45"),SubmitForm(EditForm1),DataCardValue6.SelectedDate > Today(),SubmitForm(EditForm1),ErrorKind.Conflict)
Also how do I show the error message after?
Kind regards
Tom
If this reply has answered your question or solved your issue, please mark this question as answered.
Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.
Solved! Go to Solution.
PS However, I would do it another way.
I would use exactly the same conditions, but would set the Disabled property of the submit button/icon instead.
Hence Disabled to this:
Not(DataCardValue6.SelectedDate > Today() || (IsToday(DataCardValue6.SelectedDate) && (Hour(Now())<9 || (Hour(Now())=9 && Minute(Now())<=45))) )
And OnSelect to this:
SubmitForm(EditForm1)
Hi @Tom_Slosse
Please try this:
If(DataCardValue6.SelectedDate > Today() || (IsToday(DataCardValue6.SelectedDate) && (Hour(Now())<9 || (Hour(Now())=9 && Minute(Now())<=45))) , SubmitForm(EditForm1) )
Basically the submit form action will only happen if the conditions are met, if not, then nothing happens.
PS However, I would do it another way.
I would use exactly the same conditions, but would set the Disabled property of the submit button/icon instead.
Hence Disabled to this:
Not(DataCardValue6.SelectedDate > Today() || (IsToday(DataCardValue6.SelectedDate) && (Hour(Now())<9 || (Hour(Now())=9 && Minute(Now())<=45))) )
And OnSelect to this:
SubmitForm(EditForm1)
Meneghino
Thanks for the quick reply!!!
I would love to test your solution but my lookup field for code gives an error: The lookup service call failed: An error occured on the server.
Ill try to fix it asap and will let you know if it works
Kind regards
Tom
If this reply has answered your question or solved your issue, please mark this question as answered.
Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.
I made a record in my SharePoint list and there is something strange happening.
If you fill in the form in SharePoint there is no problem, but if you start up the powerapp and refresh your records
then you see in the record that the date isn't correct. It takes the date of yesterday instead.
Could it be that I should check first on IsToday and then on the next day?
Kind regards
Tom
If this reply has answered your question or solved your issue, please mark this question as answered.
Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.
Hi @Tom_Slosse
The issue is related to the way dates are treated by different systems in different time zones. Your SharePoint server is probably in a different time zone from you, or the date is written to SharePoint in UTC but then SharePoint treates this as local, or viceversa. All very messy.
In brief, I would strongly recommend to store dates as yyyy-mm-dd text in a text column, that you can then parse when needed.
Otherwise you always have to worry about time zones.
Here is one post from me:
https://powerusers.microsoft.com/t5/PowerApps-Forum/Please-help-with-UTC/m-p/21244
And many many more....
PS The fact that you set a column to date only in SharePoint or is many other database systems does not help. This is because it does not display the time portion, but this lives on in the database, creating the issues you and others see.
Thanks for the tip but the weird thing is that it worked in another app with the same layout (testapp of my lunch). Only displaying date en it shows perfectly in the powerapp as it should it is only with this app it freaks out.
So its weird it doesnt work properly anymore.
Kind Regards
Tom
If this reply has answered your question or solved your issue, please mark this question as answered.
Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.
User | Count |
---|---|
194 | |
126 | |
90 | |
48 | |
44 |
User | Count |
---|---|
280 | |
160 | |
138 | |
81 | |
76 |