cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akbarmahfuzalam
Post Prodigy
Post Prodigy

Restrict Duplicate Entry for the End User Using form

Hi Team,

Greeting for the Day!

I need help in building the formula. The ask is- How do I restrict the user for duplicate entry so that they won't be able to make the same information input on the form.

I have a Date and a couple of text fields.

 

DateFeild Name = DataCardValue25
Enterprise ID = DataCardValue26
LOB = DataCardValue27

 

These three Feild are my key for restricting the user for not giving me duplicate entry.

 

Some sorts of the pop-up and barring them for duplicate entry.

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions

@akbarmahfuzalam 

Oh, I thought you indicated before that it was not.

 

Very good...we're done troubleshooting (I hope).  

Let's go back to the original DisplayMode property on the Submit button and change the formula to this:

If(
   IsBlank(DataCardValue33.Text) ||
   IsBlank(DataCardValue25.SelectedDate) ||
   CountRows(
       Filter(UtilizationException, 
              ShiftDate = Text(DataCardValue25.SelectedDate, "m/d/yyyy") && 
              Enterprise_ID=DataCardValue26.Text && 
              LOB=DataCardValue25.Text)       
             ) > 0,
    Disabled,
    Edit
)

 

This *should* work now.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

@akbarmahfuzalam 

Change your Queue = DataCardValue75.SelectedText to  Queue = DataCardValue.Selected.Value

Let's start there.  SelectedText is a deprecated property and should not be used.

If you don't see "Value" as you  type it in, then use whatever column your Items of your DropDown is based on. (i.e. the Items property)

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

@akbarmahfuzalam 

No, as long as that control is within scope, it should be fine.  Where people get in trouble with gallery controls is usually trying to access them outside of the gallery.

To clarify based on that statement, the DisplayMode property is of a control that is also in the Gallery, or is it outside the gallery?

 

For troubleshooting purposes, replace the PKTDate1.SelectedDate in your formula with Now()

See if there is still an error or if it changes to something else.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

53 REPLIES 53
RandyHayes
Super User III
Super User III

@akbarmahfuzalam 

 

Consider setting the DisplayMode property of your submit button...

If(
    CountRows(yourDataSource, 
              DataField=DataCardValue25.Text && 
              EnterpriseID=DataCardValue26.Text && 
              DataField=DataCardValue25.Text
             ) > 0,
    Disabled,
    Edit
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi Randy,

Thanks for your quick response. Getting one small error. If you could fix that, please

 

below are the key fields for restricting the user

 

1. Date Feild =  DataCardValue25

2. EnterpriseID =  DataCardValue26

3. LOB =  DataCardValue27

 

Error description.JPG

 

If(IsBlank((DataCardValue33.Text))|| IsBlank(DataCardValue25.SelectedDate),DisplayMode.Disabled,DisplayMode.Edit),
If(
CountRows(UtilizationException,
DataField=DataCardValue25.Text &&
EnterpriseID=DataCardValue26.Text &&
DataField=DataCardValue25.Text
) > 0,
Disabled,
Edit
)

 

Duplicate entry2.JPG

@akbarmahfuzalam 

Your syntax is incorrect...should be this:

If(
   IsBlank(DataCardValue33.Text) ||
   IsBlank(DataCardValue25.SelectedDate) ||
   CountRows(yourDataSource, 
              DataField=DataCardValue25.Text && 
              EnterpriseID=DataCardValue26.Text && 
              DataField=DataCardValue25.Text
             ) > 0,
    Disabled,
    Edit
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

 Hi

 

Invalid number of arguments: received 2, expected 1.

 

Error1.JPG

@akbarmahfuzalam 

DUH....sorry, too many things going on and trying to respond to posts too today.

I left out an important part:

 

If(
   IsBlank(DataCardValue33.Text) ||
   IsBlank(DataCardValue25.SelectedDate) ||
   CountRows(
       Filter(UtilizationException, 
              DataField=DataCardValue25.Text && 
              EnterpriseID=DataCardValue26.Text && 
              DataField=DataCardValue25.Text)       
             ) > 0,
    Disabled,
    Edit
)

 

 

Kind of helps to have the Filter statement in there 😉

Sorry about that!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

@akbarmahfuzalam 

Also...make sure you are adjusting the DataField, EnterpriseID and the other DataField names to correspond to your datasource column names.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Hi Randy,

 

There is no error this time, however, I can see duplicate entry in the SharePoint and its the submit button is also not got greyed.

 

akbarmahfuzalam_1-1594836164718.png

 

If(
IsBlank(DataCardValue33.Text) ||
IsBlank(DataCardValue25.SelectedDate) ||
CountRows(
Filter(UtilizationException,
DataField=DataCardValue25.Text &&
EnterpriseID=DataCardValue26.Text &&
DataField=DataCardValue27.Text)
) > 0,
Disabled,
Edit
)

akbarmahfuzalam_0-1594836047766.png

 

The Button is greyed out after the formula I put but the entry is still coming duplicate and it's allowing the user to get the entry into SharePoint.

 

If(
IsBlank(DataCardValue33.Text) ||
IsBlank(DataCardValue25.SelectedDate) ||
CountRows(
Filter(UtilizationException,
Shiftdate=DataCardValue25.SelectedDate &&
Enterprise_ID=DataCardValue26.Text &&
LOB=DataCardValue27.Text)
) > 0,
Disabled,
Edit
)

 

Whereas, it should stop the user by not allow the button to live. it should be greyed out.

 

SP DuplicateJPG.JPG

 

Do we need to write few code OnSlected =Set(varRecord(lookup(UtilizationException,Shiftdate=DataCardValue25.SelectedDate &&
Enterprise_ID=DataCardValue26.Text &&
LOB=DataCardValue27.Text));

If(IsBlank(varRecord.ID),

Set(varShowSpinner,true);SubmitForm(Form1);Notify("Data Uploaded Successfully",NotificationType.Success,2000);ResetForm(Form1);Set(varShowSpinner,false)..

 

Just a thought.. I know there is some issue with the formula. it's not correctly formated. 

In addition to @RandyHayes you can try giving the user information On the OnSelect of the Submit Button:

If(IsBlank(LookUp(UtilizationException,Shiftdate= DataCardValue25.SelectedDate, DateField)), Notify("Date already exist"),

  If(IsBlank(LookUp(UtilizationException,EnterpriseID= DataCardValue26.Text, EnterpriseID)), Notify("Enterprise ID Already Exist"),

  If(IsBlank(LookUp(UtilizationException,LOB= DataCardValue27.Text,LOB)), Notify("LOB Already Exist"),

  SubmitForm(Form1))))

 

------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (30,687)