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

 

 

 

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

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

 

 

 

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,019)