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
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
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
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,
Hi @TYNAI ,
I made a sample for you.
Text(DateAdd( DateTimeValue("2022-10-5 "&Dropdown1.Selected.Value),8,Hours),DateTimeFormat.ShortTime)
Best Regards,
Wearsky