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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Statement to Update...
Power Apps
Unanswered

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard