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 error che...
Power Apps
Answered

IF Statement error checking issue

(0) ShareShare
ReportReport
Posted on by 220

Hi,  I'm having an issue when editing a record.  Each time I edit a record, I check to confirm if the Date already exists in the SharePoint list and if the Date is outside the defined Pay Period dates.  IF the Date exist, I want to receive a popup that indicates Date exist - which it does.  But on confirmation of the popup, I always get a second popup, confirming Date exist.   And if the new date selected is outside the pay period, I get a popup stating that message.  And then I also get another popup stating the Date exist???  Here is my code, hope someone can help me sort this logic.  Also on the quit of the confirmation popup screens, I am clearing all data.

 


If(!IsBlank(LookUp(BonusInput, varEditEmployeeBonusSelected.TimeID = TimeID And DataCardValue11.SelectedDate=Date,ID)),UpdateContext({varEditConfirmDateExist:true}), DataCardValue11.SelectedDate < varPayPeriodSelectedDropdownStartDate || DataCardValue11.SelectedDate > varPayPeriodSelectedDropdownEndDate, UpdateContext({varEditShowPopUpConfirmSelectedDate:true}),UpdateContext({varEditConfirmDateExist:false});)
Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,854 Super User 2026 Season 2 on at

    Hi @TB05 ,

     

    There are several syntax mistakes in your code:

     

    If(
    !IsBlank(
    LookUp(
    BonusInput,
    varEditEmployeeBonusSelected.TimeID = TimeID
    And DataCardValue11.SelectedDate=Date,ID
    )
    ),
    UpdateContext({varEditConfirmDateExist:true}),

    [Should have the 'false' statement, but instead another condition is provided]
    DataCardValue11.SelectedDate < varPayPeriodSelectedDropdownStartDate
    || DataCardValue11.SelectedDate > varPayPeriodSelectedDropdownEndDate,
    UpdateContext(
    {varEditShowPopUpConfirmSelectedDate:true}
    ),
    UpdateContext(
    {varEditConfirmDateExist:false}
    );
    )

     

    Please try with the below which is correct from syntax perspective:

     

     

    If(
    	!IsBlank(
    		LookUp(
    			BonusInput,
    			varEditEmployeeBonusSelected.TimeID = TimeID 
    			And DataCardValue11.SelectedDate=Date
    		)
    	),
    	UpdateContext(
    		{varEditConfirmDateExist:true}
    	),
    	If(
    		DataCardValue11.SelectedDate < varPayPeriodSelectedDropdownStartDate 
    		|| DataCardValue11.SelectedDate > varPayPeriodSelectedDropdownEndDate,
    		UpdateContext(
    			{varEditShowPopUpConfirmSelectedDate:true}
    		),
    		UpdateContext(
    			{varEditConfirmDateExist:false}
    		)
    	)
    )

     

     

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard