web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Text box Validate To D...
Power Apps
Answered

Text box Validate To Dropdown

(0) ShareShare
ReportReport
Posted on by 17

Dear all,

I have a problem with this solution. Can anyone help me, please?

I set up App.OnStart with the Collection:

ClearCollect(NumberDaysOff, "A Day Off", "Two Days Off", "Three Days Off");

 

dropdownask.png

 

 

 

 

 

 

 

 

 

I have a label with the name "Total": LbTotal

This label "Total" is a result of calculating how many business days are there between 2 dates (excluding public holidays).

So, the result is 2.

And my idea is when the number on the label is 2. The dropdown with the name will display is "Two Days Off".

Please help me with this. 

Thank you all.

ItemsDropDownFrom.JPG

 

 

OnSelectDropDownFrom.JPG

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    Hi @Supperpro20 ,

    Firstly, make your NumberOfDaysOff like this - add more if required

    ClearCollect(
     NumberDaysOff,
     Table(
     {
     Value: "A Day Off",
     Days: 1
     },
     {
     Value: "Two Days Off",
     Days: 2
     },
     {
     Value: "Three Days Off",
     Days: 3
     }
     )
    );

    Next you will need a List with Public Holidays - I have used Holidays for the List Name and Holiday for the field name containing the holiday date.  The value you want would then be (I have used dpLeaveFrom and dpLeaveTo as the Date Picker names)

    With(
     {
     wDays: 
     RoundDown(
     DateDiff(
     dpLeaveFrom.SelectedDate,
     dpLeaveTo.SelectedDate,
     Days
     ) / 7,
     0
     ) * 5 + 
     Mod(
     5 + Weekday(dpLeaveTo.SelectedDate) - Weekday(dpLeaveFrom.SelectedDate),
     5
     ) - 
     CountIf(
     Holidays,
     Holiday >= dpLeaveFrom.SelectedDate,
     Holiday <= dpLeaveTo.SelectedDate
     ) + 1
     },
     LookUp(
     NumberDaysOff,
     Days = wDays
     ).Value
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Supperpro20 Profile Picture
    17 on at

    Dear @WarrenBelz ,

    Sorry for the misunderstanding.

    My problem is that I want to display Value in Dropdown when the value from the label "Total" appear

    I very much appreciate your support. Thank you!

     

    1. I created a collection NumberDaysOff with your instruction:

    1.png

     

    2. In the Items of Dropdown with the name DropDownFrom. I put the NumberDaysOff.Value  

    2.png

     

    3. The Label with the name LbTotal is calculated

    4.png

     

    4. I want to display value in DropDownFrom when the label with the name LbTotal is Value

    Example :

    Total is "1" = DropDownFrom "A Day Off"

    Total is "2" = DropDownFrom "Two Days Off"

    Total is "3" = DropDownFrom "Three Days Off"

     

    3.png

     

  • Verified answer
    WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    @Supperpro20 ,

    All that is required these is 

    LookUp(
     NumberDaysOff,
     Days = Value(YourLabel.Text)
    ).Value

    but to be honest I would repeat the code I posted as relying on calculated labels in a formula is not a good practice.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Supperpro20 Profile Picture
    17 on at

    Dear @WarrenBelz ,

    I got it. Thank you so much!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard