cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KevinHardy
Level 8

Visible if dropdown2 less than dropdown1

HiAll,

 

Frustrated of Fareham here with another question 😀

I have a Start hour dropdown and an End hour dropdown. I want to prevent the user entering an end time that is before the start time (I know - they're idiots aren't they). No idea how to do this with validation, so I tried just having a red text label pop up if it was using: 

If(HourDropdown_2.Selected.Value <= HourDropdown_1.Selected.Value,true,false)

HourDropdown_2 is End time and HourDropdown_1 is Start time.

But it doesn't work 😏

 

Screenshot 2019-12-03 at 11.28.55.png

 

Is there a way of doing some kind of value validation on the actual dropdown? If not, any idea why my formula doesn't work - It's usually because I have ) or ( or , or . in the wrong place or used '.Value' when it should be something else. But believe me I have tried lots of different ways without success. Is it because the Data type is text?

 

A second issue I will mention while we're on the subject of time: How do you stop the user selecting a date in the future on a DatePicker dropdown?

 

Kev

1 ACCEPTED SOLUTION

Accepted Solutions
KevinHardy
Level 8

Re: Visible if dropdown2 less than dropdown1

Hi @mdevaney 

 

I managed to work it out for myself eventually 😀

If(Value(HourDropdown_2.Selected.Value) <= Value(HourDropdown_1.Selected.Value), true, false)

 

Thanks for your help! And I'll definitely check out the link you gave me.

 

Kev

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Visible if dropdown2 less than dropdown1

@KevinHardy 

There are many questions in this post.  Lets resolve your issue shown in the screenshot first.

 

It looks like there is no column called Value for the data used in your Items property.  Can you please type this code into the formula bar and wait to see what appears in the autoselect menu?  Likely there is some different name than Value.

HourDropdown_2.Selected.

 

Now for your 2nd question "how do you stop the user selecting a date in the future on a DatePicker dropdown?"  There is currently no way to restrict dates in the DatePicker by changing a property.  In my humble opinion this is one the areas in PowerApps needing immediate attention.  For a workaround check out this blog by April Dunham (SharePoint Siren).  I saw her speaking live at MS Ignite this year and the talk she gave was pretty excellent.  You can trust her to give you good advice.

 

Link To April's website

https://www.sharepointsiren.com/2019/05/powerapps-restricting-date-picker-options/

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

KevinHardy
Level 8

Re: Visible if dropdown2 less than dropdown1

Hi @mdevaney 

 

Screenshot 2019-12-03 at 12.40.33.png

You're right. There is no column called Value - which explains why I'm always having trouble like this as I hadn't realised it needed to be that 🙄

However, it does only offer Value as an option.

The columns in Sharepoint are actually StartTime and EndTime and I have dropdowns for both Hour and Minutes which I then join in a label to update the list with:

Time(Value(HourDropdown_1.Selected.Value), Value(MinutesDropdown_1.Selected.Value), 0)

 

Kev

KevinHardy
Level 8

Re: Visible if dropdown2 less than dropdown1

Hi @mdevaney 

 

I managed to work it out for myself eventually 😀

If(Value(HourDropdown_2.Selected.Value) <= Value(HourDropdown_1.Selected.Value), true, false)

 

Thanks for your help! And I'll definitely check out the link you gave me.

 

Kev

View solution in original post

Super User
Super User

Re: Visible if dropdown2 less than dropdown1

@KevinHardy 

It appears your Dropdown was holding text values for some odd reason.  That's why putting the reference inside VALUE was necessary.

 

Please remember to close the thread if the issue is now resolved.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

KevinHardy
Level 8

Re: Visible if dropdown2 less than dropdown1

Hi @mdevaney 

 

I've had a look to see why it it a text value. I think it's because the Sharepoint columns are SIngle Line Text rather than Number. I will try to remember to get this right in future 😀

 

Thanks again for your help

 

Kev

Super User
Super User

Re: Visible if dropdown2 less than dropdown1

@KevinHardy 

Yup, wrong SharePoint column type: that would do it.  Best of luck in building your app!  

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (3,857)