cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sasrsc
Helper V
Helper V

unique id column

This is a real novice question but using Oakdale for the first time. Previously I had only used SP Lists within Power Apps. So I created 3 tables adding my custom columns and fully expected there to be an "ID" column added behind the scenes for the row. This doesn't appear to be the case. 
I thought, that's surprising, and added a new column called ID and just took the defaults adding it as an auto number and made it required (but expecting the system to do it for the user). 
I then went to the visual editor and it stopped me from proceeding as it was an unsaved row. I don't want to type it in. 
1) What am I doing wrong
2) Is that how you create a true ID column 
3) How do you make the ID column the primary key after you've created it. Right now the "name" column defaults to the primary key and it seems logical to me that you'd make the ID value the primary key.

4) There are mentions of a GUID in other posts but I physically can't see it in the table column listing...even with "all" selected. That GUID would mean I don't need to add my own ID column.

1 ACCEPTED SOLUTION

Accepted Solutions
EricRegnier
Super User
Super User

Hi @sasrsc,

Just supplementing on @ChrisPiasecki and answering your specific questions:

  1. You are doing nothing wrong. ID is auto generated as a GUID type and is the default primary key as correctly mentioned in the previous post. In Power Apps Studio navigate to the table/entity and you can see this ID generated:
    2020-10-28_18-03-51.png
  2. You can create a custom auto number column, but you can't configure it as a true alternate key. In standard CDS you can:
    2020-10-28_18-05-44.png
  3. As per #1 and #2
  4. Correct, see #1

Hope this helps!

 

View solution in original post

5 REPLIES 5
ChrisPiasecki
Super User
Super User

Hi @sasrsc ,

There is always an ID (guid) behind the scenes for tables in Oakdale. It will be of type 'Unique Identifier' and will be prefixed with the tablename+"id".

Optionally, if you want to create your own display friendly auto-generated field, you could create a field as an auto-number type. You should not make it required as it will be auto-generated for you. 

 

---

Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

 

EricRegnier
Super User
Super User

Hi @sasrsc,

Just supplementing on @ChrisPiasecki and answering your specific questions:

  1. You are doing nothing wrong. ID is auto generated as a GUID type and is the default primary key as correctly mentioned in the previous post. In Power Apps Studio navigate to the table/entity and you can see this ID generated:
    2020-10-28_18-03-51.png
  2. You can create a custom auto number column, but you can't configure it as a true alternate key. In standard CDS you can:
    2020-10-28_18-05-44.png
  3. As per #1 and #2
  4. Correct, see #1

Hope this helps!

 

Wow, thank you - both of you are correct and I can only accept one solution.
I do have a follow up question...I had created originally 3 custom column values...
I used the name column which is "suggested" when you create the new table, which I then made as an autonumber (that - thanks to your posts) I now realize is unnecessary.
I added the ListID and the TagID (both lookups) that I do need and because the table has the built in ID/GUID "cr9c7_vareportlisttagsid" am I now safe to delete the Name column even though it's tagged as the Primary Name Column?


sasrsc_0-1603875691674.png

sasrsc_1-1603875786152.png

 

unfortunately you can’t delete the primary field column. Any chance you can delete the entity/table and recreate it?

I could do that. I'm early in the dev cycle here. 
But when it presents the wizard for the new table Name is there by default.
Sure I can change the name value but it requires something that is either text or auto-number.
In my case, I only need 2 Lookup Columns, but there's no harm in having what I have so I guess I'll leave it.

sasrsc_0-1603878959182.png

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,284)