I just want to ask if there is a way in which i can Disable a button after it has been clicked and enable it back the following day.
Solved! Go to Solution.
Hi @damilola79 ,
You are doing this to set the data
ClearCollect(
onClickHandler,
{
ClickEventDate: Now(),
User: User().Email
}
)
This may be a bit of overkill, but I am trying to avoid potential errors
With(
{
wEvent:
Lookup(
onClickHandler,
User=User().Email
).ClickEventDate
},
If(
IsBlank(wEvent)
DisplayMode.Edit,
If(
DateDiff(
wEvent,
Now(),
Days
) >= 1,
DisplayMode.Edit,
DisplayMode.Disabled
)
)
)
Note that this formula tests for a 24 hour difference. If you want just the next day, use Today() instead of Now().
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi,
You need to store the click event date and who clicked the button, into a database or locally on the device, then, check if that variable is older than today to shows the button as "Display.Edit"
For Example. Try this,
"On select" Button event:
ClearCollect(
colEnableButton,
{
ClickEventDate: Now(),
User: User().Email
}
);
SaveData(
colEnableButton,
"colEnableButton"
)
"DisplayMode" Button property:
If(
Or(
DateDiff(
First(colEnableButton).ClickEventDate,
Now(),
Days
) >= 1,
IsEmpty(colEnableButton)
),
DisplayMode.Edit,
DisplayMode.Disabled
)
"OnStart" App event:
LoadData(
colEnableButton,
"colEnableButton",
true
)
NOTE:
My example works only on mobile devices or powerapp desktop application because "SaveData" and "LoadData" functions are an Offline features not supported by browsers.
You can store the "colEnableButton" collection into a databese too, then get it by the User().email, as an "ID", to be sure that the button will be disabled to him if corresponds.
Regards!
Please it didnt work
Hi!
Can you share us more information about the error?
There is no error but it just doesnt work
Set(
myLocation,
BingMaps.GetLocationByPoint(
Location.Latitude,
Location.Longitude
).name
);
ClockItFlow.Run(
User().FullName,
myLocation
);
UpdateContext({popup: true});
ClearCollect(
onClickHandler,
{
ClickEventDate: Now(),
User: User().Email
}
);
SaveData(
onClickHandler,
"onClickHandler"
)
@damilola79 Ok, so, is that your "OnSelect" button formula?
Share me the "DisplayMode" button property and OnStart App please.
Dario.
If(
Or(
DateDiff(
First(onClickHandler).ClickEventDate,
Now(),
Days
) >= 1,
IsEmpty(onClickHandler)
),
DisplayMode.Edit,
DisplayMode.Disabled
)
Hi @damilola79 ,
You are doing this to set the data
ClearCollect(
onClickHandler,
{
ClickEventDate: Now(),
User: User().Email
}
)
This may be a bit of overkill, but I am trying to avoid potential errors
With(
{
wEvent:
Lookup(
onClickHandler,
User=User().Email
).ClickEventDate
},
If(
IsBlank(wEvent)
DisplayMode.Edit,
If(
DateDiff(
wEvent,
Now(),
Days
) >= 1,
DisplayMode.Edit,
DisplayMode.Disabled
)
)
)
Note that this formula tests for a 24 hour difference. If you want just the next day, use Today() instead of Now().
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @damilola79 ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Thank You sir i tried it again today and it worked perfectly.
Once again thank you.
User | Count |
---|---|
257 | |
110 | |
97 | |
52 | |
39 |