cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WesselO
Helper II
Helper II

Disabling a button when current date doesn't match the given date

So i have a QR code that puts out a email and then a date, then the email is used to find more data on the user. this all works.
But the date is also given as more of a security reason, when it doesn't match the current date the user shouldn't be able to press the next button to continue the process. 

the data this variable puts out is 24-07-2020, i checked this by putting it in a text field and looking at the output. 

WesselO_0-1595602154466.png

 

"Datum: " & _gastdatum

 

 
i tried adding the code below to the displaymode tag of the button itself, 

If(IsToday(DateTimeValue(_gastdatum, "DD-MM-YYYY")),
    DisplayMode.Edit,
    Disabled
)

 

 

But unfortunately, the button stays the same even thought he dates are matching.
If u need any more info please let me know. 
Any insight or help would be appreciated, thank you so much. 


1 ACCEPTED SOLUTION

Accepted Solutions

Hi @WesselO ,

 

Try this for the final time on DisplayMode property:

If(Text(Today(),"dd-mm-yyyy") = Text(_gastdatum, "dd-mm-yyyy"),DisplayMode.Edit,DisplayMode.Disabled)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

9 REPLIES 9
KrishnaV
Super User III
Super User III

Hi @WesselO ,

 

try this:

If(Text(Today(),DateTimeFormat.ShortDate) = Text(gastdatum,DateTimeFormat.ShortDate),
    DisplayMode.Edit,
    Disabled
)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
eka24
Super User III
Super User III

Try

If(IsToday(DateValue(_gastdatum, "DD-MM-YYYY")), DisplayMode.Edit, Disabled )

If(Text(Today'"DD-MM-YYYY")=Text(_gastdatum, "DD-MM-YYYY"), DisplayMode.Edit, Disabled )

 

If you have issues, explain how you got the variable _gastdatum further 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hey Krishna, 
i tried this and unfortunately it doesn't work for me. 
after scanning the qr code with a correct date the button is still greyed out for me,

a screenshot below.

 

IMG_20200724_165834

Hi @WesselO ,

 

try this:

if(Text(Today(),"dd-mm-yyyy") = Text(columnName,"dd-mm-yyyy"),Edit,Disabled)

Note: "dd-mm-yyyy" is case sensitive 

 

I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hey eka24,

 

i tried both your solutions and unfortunately it didnt work for me.

the way i get this variable is through scanning a qr code, which is this link
https://chart.googleapis.com/chart?cht=qr&chl=example@email.nl,24-07-2020&choe=UTF-8&chs=400x400

i then proceed to split the email and the date from eachother like so,

Set(_gastemail, First(Split(btn_scanner_qr.Value, ",")).Result),
Set(_gastdatum, Last(Split(btn_scanner_qr.Value, ",")).Result)

this gets done on qr scan, after which the data gets shown on screen and u get the option to continue, this is where the button part comes in and the button should be disabled when the date isn't correct.

hey KrishnaV, thank you for the continueous help.

i get a error code here, not sure what it is. 

WesselO_0-1595603310143.png

 

Hi @WesselO ,

 

Try this:
Set this to Display mode property:

if(Text(Today(),"dd-mm-yyyy") = Text(columnName,"dd-mm-yyyy"),DisplayMode.Edit,DisplayMode.Disabled)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hey krishnaV,

unfortunately i get the same error.

Hi @WesselO ,

 

Try this for the final time on DisplayMode property:

If(Text(Today(),"dd-mm-yyyy") = Text(_gastdatum, "dd-mm-yyyy"),DisplayMode.Edit,DisplayMode.Disabled)

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (31,257)