cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
m365newuser
Frequent Visitor

Update date picker values in an if statement

For context, I am building an app to record my shift hours during the week. I have made a dialog, to prompt if the start time and end time are match my usual schedule, based on the day of the week.

 

Screen 1: Dialog on BrowseScreen1

 

Screen Shot 2021-01-19 at 8.07.03 PM.png

 

 

So far I have programmed the Yes button to close the popup and go to EditScreen1(Form where I enter the data). I want an if statement inside the Yes button, to update the date and time values of EditScreen 1. Can someone advise how to accomplish this

 

For reference:

Screen 2: Edit Screen 1

 

 Screen Shot 2021-01-19 at 8.13.35 PM.png

5 REPLIES 5
gabibalaban
Super User II
Super User II

Hi @m365newuser ,

My approach to your request:

set a global variable inside the OnSelect property of Yes button:

Set(isNormalShift,true)

And set then the default property of controls (my guess is this are dropdown boxes)

IN hour  to:

If(isNormalShift,"23",Hour(Now())) 

IN minutes:

If(isNormalShift,"00",Minute(Now())

OUT hour:

If(isNormalShift,"06",Hour(Now())) 

OUT minutes:

If(isNormalShift,"00",Minute(Now())

Also set the default date of Out DatePicker to:

If(isNormalShift,DateAdd(Today(),1,Days)

 

Hope it helps !

Hi @gabibalaban , I am new to Power Apps so please excuse any obvious things that I miss.

 

Can I ask how does your solution take into account the day of the week, my shift hours for each day varies. 

Secondly you mention to place (If(isNormalShift,"23",Hour(Now())) ) as default values, but I already have the default set to show the current date and time . I did this to save time selecting from the drop down and just straight away punching in the hours. Do I need to keep both or can your statement also display current time as an else statement 

@m365newuser ,

Well no .... Where do you keep your shift planning ? Is there a schema of your shift during the week ?

Regarding the second question formula  If(isNormalShift,"23",Hour(Now())) can be explained like this ...

If the user selected Yes button then show as default the "23", else show as default the now hour.

We have to get a logic off your shifts to create the schema.

 

@gabibalaban 

Again sorry I am new to power apps, when you refer to schema, should that be like a Sharepoint list or a screen in the app with the schedule detail. 

Could you guide with the logic for the shifts?

m365newuser
Frequent Visitor

Hello @WarrenBelz , would appreciate your advice or feedback

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,289)