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 / If Statement to Update...
Power Apps
Answered

If Statement to Update Pop up Context

(0) ShareShare
ReportReport
Posted on by

Good Morning,

 

I am trying to write an IF statement that will check if the selected date is a Friday if so it will navigate to the next screen if it is not it will update context to true so a dialog box pops up on the screen. I have the following syntax but i can't get it to work. Any help is appreciated. 

 

jubae22_0-1686848209962.png

 

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @jubae22,

     

    Please try the adjustment below:

    If(
     Weekday(BusinessDay_DatePicker.SelectedDate,StartOfWeek.Monday) = 5,
     Navigate(TimeCardNew, ScreenTransition.Cover),
     UpdateContext({VarName:true}) //Change to the correct variable name
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • CU30071822-0 Profile Picture
    on at

    Thank you so much LaurensM , ur updated syntax is working great!!!!!

     

    I have one more IF statements i won't to put in there but not sure how to embed two IF statements

     

    If(
    Weekday(BusinessDay_DatePicker.SelectedDate,StartOfWeek.Monday) = 5,
    Navigate(TimeCardNew, ScreenTransition.Cover),
    UpdateContext({ClndrNo:true}) //Change to the correct variable name
    );

    IsBlank(
    LookUp(
    Timesheet_Entries_T,
    'Employee Name' = User().FullName And WeekEnding = BusinessDay_DatePicker.SelectedDate,UpdateContext({VarName:true}),Navigate(TimeCardNew,ScreenTransition.Cover
    )

     

    I want my two if statements to 1. check if the selected date is a Friday and also check if the selected week ending date does not already exist in my table for that specific user .... if the user selects a friday and that friday date does not exist in the my table then i want it to navigate to my next screen. 

     

    Hope that makes sense. 

  • LaurensM Profile Picture
    12,516 Moderator on at

    Glad to help @jubae22 😊

     

    You can either enclose if statements such as If(Condition 1, If(condition2, if2true, if2false), if1false) or use multiple conditions within the same if statement - the latter is needed in this particular case:

     

    If(
     //If Friday is selected and does not exist in the timesheets
     Weekday(BusinessDay_DatePicker.SelectedDate,StartOfWeek.Monday) = 5 && 
     IsBlank(
     LookUp(
     Timesheet_Entries_T,
     'Employee Name' = User().FullName && WeekEnding = BusinessDay_DatePicker.SelectedDate
     )
     ),
     //Navigate to the time card screen
     Navigate(TimeCardNew, ScreenTransition.Cover),
     //Else show pop-up
     UpdateContext({VarName:true}) //Change to the correct variable name
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • CU30071822-0 Profile Picture
    on at

    There is actually to different dialog boxes that i want to appear. Obviously they both won't appear at the same time. It depends on the scenario they selected. 

    UpdateContext({ClndrEx:True})

    jubae22_0-1686857258089.png

     

    UpdateContext({ClndrNo:True})

    jubae22_1-1686857420744.png

     

     

     

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @jubae22 

     

    The code below should do the trick when using 2 pop-up types 😊:

     

    If(
     //If Friday is not selected, show faulty date pop-up
     Weekday(BusinessDay_DatePicker.SelectedDate,StartOfWeek.Monday) <> 5,
     UpdateContext({ClndrNo:true}),
     //If Timesheet entry exists, show timesheet error pop-up
     !IsBlank(
     LookUp(
     Timesheet_Entries_T,
     'Employee Name' = User().FullName && WeekEnding = BusinessDay_DatePicker.SelectedDate
     )
     ),
     UpdateContext({ClndrEx:true}),
     //Else navigate to the time card screen
     Navigate(TimeCardNew, ScreenTransition.Cover)
    )

     

    I hope this helps!

  • CU30071822-0 Profile Picture
    on at

    Thanks again LaurenMS for your help! the last code worked!!!!!!

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard