PowerApps using SQL primary key and auto increment

  • PowerApps using SQL primary key and auto increment

    Posted by John Heck on May 12, 2021 at 3:43 pm
    • John Heck

      Member

      May 12, 2021 at 3:43 PM

      Hello, working with PowerApps and SQL.  I have an orders table that the user needs to add existing paper orders to the table.  Each order has an order id that is unique.  They need to be able to enter the existing paper orders in this new system with the original order id, between 5,000 and 8,000 (not consistent numbers).  I can not get a form to add a record to the SQL table with out a primary key and it seems that it needs to be incremental.  I would like the user to be able to add the paper orders with the original order id and then turn on the incremental and start the seed number at 9,000.  Is this even possible in PowerApps?

      Thanks in advance for your help.
      Kind regards,

      ——————————
      John Heck
      ——————————

    • Toni Malcolm

      Member

      May 13, 2021 at 2:45 PM

      John you will not be able to use the ID field for Order ID as that is auto generated. I suggest you create a field called Order ID.

      ——————————
      Toni Malcolm
      GIS Supervisor
      Mesa
      ——————————
      ——————————————-

    • ISAAC P

      Member

      May 13, 2021 at 3:07 PM

      It sounds like you are facing a typical data migration project and not really much to do with PowerApps.

      Alternative approach idea:

      1. Create a copy of the intended destination SQL table and point your PowerApps toward that
      2. In this copy table, create an ID column – NOT auto generated, Identity, etc
      3. Allow users to input the ID number.
      4. Once you are ready to actually do the data migration, turn IDENTITY INSERT ON (on the true, final destination table, the one that has the ID identity column)
      5. Perform the insert from the copy table to the final table – inserting the copy.ID to the destination.ID
      6. Turn IDENTITY INSERT OFF (on the true, final destination table).
      7. Carry on with life …

      Or you might be able to skip the copy table idea, just create an extra ID-type column to hold the manually input one.  Later on, turn identity insert on, perform an Update query to the ID, then turn identity insert back off.?

      ——————————
      ISAAC P
      ——————————
      ——————————————-

    John Heck replied 3 years ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘PowerApps using SQL primary key and auto increment’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for people  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!