Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

DropDown time items

(0) ShareShare
ReportReport
Posted on by

Hello i have two drop down boxes having various times of the day. e.g. 6:00 AM, 6:30 AM, 7:00 AM, 7:30 AM...

 

I would like that when I choose the first drop down e.g. 8:30 AM the second drop down automatically add 8 hours to the second drop down box. e.g., if I choose 8:30 AM on the first dropdown the second drop down automatically adds 8 hours to the time and becomes 4:30 PM.

 

The drop down is structured as below, an assist on this would be great. Thank you

 

9.PNG

  • TYNAI Profile Picture
    TYNAI on at
    Re: DropDown time items

    Hi @v-xiaochen-msft ,

     

    Thank you for your fast reply,

     

    i understand the first answer, thank you.

     

    What if for the second drop down i wanted users also to be able to choose other timings apart from the default calculated 8 hours? maybe a user can be able to choose 2:00 PM or 6:00 PM, but the drop down still hold the default calculated 8 hours when the user decided not to change the timings for that particular day i.e incase he forgets or its a regualar day... by the way this is a timesheet kind of APP

     

     

  • Re: DropDown time items

    Hi @TYNAI ,

     

    First question:

    Because the datetimevaule() function requires a datetime parameter, so I add a date like '2022-10-5'. You can use any date here. 

    Second question:

    It's by design. The second dropdown will show its default value when you reset it. Since it has the value of the first drop-down in its default property, the reset event is triggered when you change the option of the first drop-down.

     

    Best Regards,

    Wearsky

  • TYNAI Profile Picture
    TYNAI on at
    Re: DropDown time items

    Hello @v-xiaochen-msft ,

     

    Thank you the code works! only two issues

    1) What is the purpose of the "2022-10-5" in the code.

    2) It seems once you use that code on the second drop down, the user not able to choose another time apart from the default + 8 hours e.g dropdown 1 is 8:30 AM, by default it will add 8 hours which is 4:30 PM but if you try selecting 5:00 PM on drop down 2, it default back to 4:30 PM, 

  • Re: DropDown time items

    Hi @TYNAI ,

     

    I made a sample for you.

    vxiaochenmsft_0-1668664636326.png

    vxiaochenmsft_1-1668664650504.png

    vxiaochenmsft_2-1668664663344.png

    Text(DateAdd( DateTimeValue("2022-10-5 "&Dropdown1.Selected.Value),8,Hours),DateTimeFormat.ShortTime)

     

    Best Regards,

    Wearsky

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard