cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TB05
Resolver I
Resolver I

IF Statement error checking issue

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});)
1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

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}
		)
	)
)

 

 

 

 

View solution in original post

1 REPLY 1
BCBuizer
Super User
Super User

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}
		)
	)
)

 

 

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,903)