web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / New form submission - ...
Power Apps
Answered

New form submission - Duplicate error when it's not a duplicate

(0) ShareShare
ReportReport
Posted on by 14

Hello.

 

I've set up the following code on the "OnSelect" property of my submit new form. I have my data linked to an excel file.

 

If(
EditForm1_1.Mode = FormMode.New And CountRows(
Filter(
Tabell1,
Upper(Artikkelnummer) = Upper(DataCardValue8_1.Text)
)
) = 0,
SubmitForm(EditForm1_1),
Notify(
"En artikkel med dette artikkelnummeret finnes allerede.",
NotificationType.Error,
5000))

 

In the excel file I have EPP002908SP on one row. But when I tried addon a new one with EPP002908SP-B I got the error saying it's already registered in the excel file. 

But if I have one named Test, and try adding Test-B, I'm allowed to submit the new form. 

 

Any tips? I thought the new EPP002908SP-B was unique and ok to post to the excel file?

 

Please let me know if I need to give you more information about my app.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @Eveneggerud ,
    Excel is not the best data source for complex queries, but try this

    With(
     {
     wDup:
     LookUp(
     Tabell1,
     StartsWith(
     DataCardValue8_1.Text,
     Artikkelnummer
     )
     ).Artikkelnummer
     },
     If(
     EditForm1_1.Mode = FormMode.New &&
     IsBlank(wDup),
     SubmitForm(EditForm1_1),
     Notify(
     "En artikkel med dette artikkelnummeret finnes allerede.",
     NotificationType.Error,
     5000
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Eveneggerud Profile Picture
    14 on at

    Hi Warren.

     

    I'm just building a small app for myself to use, so I thought excel would be sufficient. 

     

    I tried adding EPP002908SP-B, but I'm still not allowed to submit. I tried EPP002908SB for fun, and that was allowed. I've attached the excel file, maybe I've formatted the rows incorrectly?

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @Eveneggerud ,

    I do not use Excel, so cannot troubleshoot it, but both pieces of code should work - it is just that Upper() is not Delegable, so I used StartsWith() which is not case sensitive. If you put this in a Label

    LookUp(
     Tabell1,
     StartsWith(
     DataCardValue8_1.Text,
     Artikkelnummer
     )
    ).Artikkelnummer

    do you get any result ? If you get nothing, logic tells you it is blank and therefore the code should work. If you get a result, you need to look at your data.

  • Eveneggerud Profile Picture
    14 on at

    Hi @WarrenBelz 

     

    Interesting. I've added a text label as you suggested, and typing EPP002908SP-B in the datacard  returns EPP002908SP in the text label using the lookup formula.

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    @Eveneggerud ,

    As I mentioned Excel is best avoided if you have access to SharePoint - it makes no sense that EPP002908SP starts with EPP002908SP-B (the other way around is true)

  • Verified answer
    Eveneggerud Profile Picture
    14 on at

    Hello @WarrenBelz 

     

    I tried creating an app from a new sharepoint list, and the formula with the "StartsWith" acted identical. I did however manage to figure out a solution using the following change.

     

    With(
     {
     wDup:
     LookUp(
     Tabell1,
     DataCardValue8_1.Text = Artikkelnummer
     ).Artikkelnummer
     },
     If(
     EditForm1_1.Mode = FormMode.New &&
     IsBlank(wDup),
     SubmitForm(EditForm1_1),
     Notify(
     "En artikkel med dette artikkelnummeret finnes allerede.",
     NotificationType.Error,
     5000
     )
     )
    )

     

    1.png2.png

  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    @Eveneggerud ,

    Yes, equals will work if not case sensitive

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard