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 / Problem of dupliation ...
Power Apps
Unanswered

Problem of dupliation a secuential number

(0) ShareShare
ReportReport
Posted on by 103

Hi everyone:

 

I've been developing an app that creates a secuential number depending on the region-year-casetype-seqnum for example Car2019Ley121-002.  This sequential number is form in the text property of the label and is store at the Submit buttom.  The problem is that, at testing, I had duplicity of the same number under the same conditions. If two employees under the same conditions (same region, same case type,etc ) consult the next number to be, it could happen that at the time to save the info, they have assign the same number in the sequence.  Can I lock the SQL table before the submition to avoid duplicity?  I need to assign a temporary number before writing at the SQL table?

 

Any help I will appreciate.

 

veronica

Categories:
I have the same question (0)
  • Mr-Dang-MSFT Profile Picture
    on at

    @Veronica,

    Edit:

    I'd look into primary keys and composite keys as they are unique.

     

    + SQL experts @KroonOfficeSol , @DavesTechTips @seadude 

  • Veronica Profile Picture
    103 on at

    I change my primary key but also I think the problem is that the sequential number is built in the text property when I invoke the form.  The user consult the next number but is not until the summit buttom that the number is written in the table.  In that period of time when the user is filling the others fields another user could consult and asign the same sequential number.  Thats why I was asking if I could lock the table or asign a temporary number.

  • Community Power Platform Member Profile Picture
    on at

    Hi @Veronica ,

    I think you've found a common problem that most databases have. There are only a few ways of ensuring duplicate values aren't set when two users create records at the same time. This is usually something delegated to the database to handle using:

    primaryKeyColumnName INT IDENTITY(1,1) NOT NULL PRIMARY KEY

    Here are the docs on `IDENTITY` 

    Hope this helps!

  • Community Power Platform Member Profile Picture
    on at

    And why not as a bonus add this wonderful post on Stack Overflow by @CarlosFigueira and that goofball @seadude 🙂 in case you want to:

    • Take the Primary Key from one table's Patch statement
    • Use it as the Foreign Key of another table's Patch statement

    $10k code right there!

  • Veronica Profile Picture
    103 on at

    Thanks a lot for your help.  I will check the info and I will let you know...

  • Community Power Platform Member Profile Picture
    on at

    Hi, 

    I think if I understood you correctly you want to store in the table the primary key you generate from the app and you don't want it to duplicated. Is that corrected ? 

     

    If so, you may possiblely patch the table whenever first user starts to use one number ( may be write the patch in a control select etc) with a status and then delete it if the user is not completing the rest of the fields. 

     

    By this any user logs in to use the same number will find it with the status "in progress" and can't use it again. 

     

    Hope this helps. 

     

    Thanks, 

    Deb

  • Veronica Profile Picture
    103 on at

    I am tring another approch, to recalculate the sequential number just before saving by hiding the save button.

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard