I need a solution for my app.
My users are sending forms daily and I want to prevent them sending it more than once.
I'd like to make that by blocking button access to the screen if user was already there.
Do you guys have any idea?
I tried to make some variable but I have no idea how to reset them at midnight.
Une solution pourrait être de créer une table dans laquelle vous enregistrez le nom d'utilisateur, l'écran, la dernière date d'utilisation.
Il suffira ensuite de tester la date avec la date du jour pour autoriser ou interdire le bouton correspondant
I am using Sharepoint list as a data source.
You mean I should create a new list, and in patch function save date and name of user that submitted a form.
Then I make a validation if he made such a thing Today() and if yes block buttons?
I will try to do this, but I'm not really great in Patch() functions.
In one of my apps I wanted to do similar thing. Easiest way I found was something like that:
-In my menu, I added to onSelect :
If( IsEmpty( Filter( Status, Created >= Today(), Title = User().FullName ) ), Set( StatusCheck, true ), Set( StatusCheck, false )
Which basicly checks if given user added a record today ( Status is my sharepoint list DataSource, in Title I store user fullname, but you can use anything, as long as it is unique identifier).
-Then set form and button visibility to StatusCheck, then added label with visiblity !StatusCheck, which informed user that he already provided this info today.
If you need any futher explanation let me now 😉
Seems to be working.
If(IsEmpty( Filter( WhoIsThere, Created >= Today(), 'Email storage'.Email = User().Email ) ),Navigate(Screen5_JobisDone,None),Notify("You cannot do that again!.",NotificationType.Error))
I changed it to allow to Navigate and show error message.
I will have to check tommorow if this works, but the real test would be on 23.59...
I have a lot of bad experiance with Today().
You have to restart app in order to re-set value of Today(), since it's being assigned probably somewhere around launching - this is my observation. Also, if you are using proxy, timezones might not be correct, so it can be different hour than midnight.