cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How do i notify user if two fields in the form have same value?

Hi,

 

I have a form with To and From Office fields in an App recording the movement of mail within the company; both fields are Dropdown controls with the Office values populated into Items (rather than looking up values elsewhere). I want to notify users when the To and From values are the same as they should never be the same.

 

I have played around with a timer to show an error when the values are the same. Problem is I haven't quite figured out how to not show this error when there are blank values in both drowdown controls (which are the default values ). So as soon as the form loads the error message is displayed, I only want this to display if they have selected values other than blank e.g. To=Glasgow, From=Glasgow.

 

This is the formula  I have against the Timers OnTimerEnd variable: If(!IsBlank(DropdownNewSenOffice.SelectedText.Value) = !IsBlank(ReceivingOfficeNew.SelectedText.Value) ||!IsBlank(DataCardValue32.Selected.DisplayName) = !IsBlank(DataCardValue9.Selected.DisplayName),Notify("Please check the form for duplicate values",NotificationType.Error))

 

Any advice on above or alternative solutions would be very welcome

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Hi @mikiepat 

I have tested this logic out with two text input boxes and it works like I think you want it to.

I have put a formula in the OnChange property of each of the text input boxes rather than using a timer. Then the values will be compared any time one of the values changes.

 

The formula in the OnChange property of TextInput1 is:

 

If(Not(IsBlank(TextInput1.Text)),If(TextInput1.Text=TextInput2.Text,Notify("Values should be different")))

 

and for the OnChange property of TextIput2 it is:

 

If(Not(IsBlank(TextInput2.Text)),If(TextInput1.Text=TextInput2.Text,Notify("Values should be different")))

 

 

View solution in original post

2 REPLIES 2
Highlighted
Helper I
Helper I

Hi @mikiepat 

I have tested this logic out with two text input boxes and it works like I think you want it to.

I have put a formula in the OnChange property of each of the text input boxes rather than using a timer. Then the values will be compared any time one of the values changes.

 

The formula in the OnChange property of TextInput1 is:

 

If(Not(IsBlank(TextInput1.Text)),If(TextInput1.Text=TextInput2.Text,Notify("Values should be different")))

 

and for the OnChange property of TextIput2 it is:

 

If(Not(IsBlank(TextInput2.Text)),If(TextInput1.Text=TextInput2.Text,Notify("Values should be different")))

 

 

View solution in original post

Highlighted

Thanks AnneZC!

That worked a treat! I adapted the above formula to four fields as follows:

 

Dropdown1: If(Not(IsBlank(Dropdown1.Selected.DisplayName)),If(Dropdown1.Selected.DisplayName=Dropdown2.Selected.DisplayName,Notify("Values should be different")))

Dropdown2: If(Not(IsBlank(Dropdown2.Selected.DisplayName)),If(Dropdown2.Selected.DisplayName=Dropdown1.Selected.DisplayName,Notify("Values should be different")))

Dropdown3: If(Not(IsBlank(Dropdown3.Selected.Value)),If(Dropdown3.Selected.Value=Dropdown4.Selected.Value,Notify("Values should be different")))

Dropdown4: If(Not(IsBlank(Dropdown4.Selected.Value)),If(Dropdown4.Selected.Value=Dropdown3.Selected.Value,Notify("Values should be different")))

 

Dropdowns 1 & 2 are people picker dropdowns and Dropdowns 3 & 4 are standard dropdowns

 

thanks

 

Mike

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (13,603)