cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wahlbang
Regular Visitor

Unique ID when creating a form

Hi everyone,

I'm trying to create a knowledge database in Microsoft List / Sharepoint.

I would like when my colleagues creates and knowledge article the title gets an unique title / ID.

For exampel:
Title: KB0000001


And when the next person creates an article the title will be default be KB0000002 and so on and so on.
Think you get the point, but how do I do it? 🙄

Any bright brains out here that can help me?

Best regards,

Sebastian

5 REPLIES 5
gabibalaban
Dual Super User
Dual Super User

Hi @wahlbang ,

 

You didn't mention how you save the data in sharepoint ... using Patch () function or with a Form control. 

The formula you can use:

"KB"&
Text(
     Value(
            Right(
                  Last(yourdatasource).Title,7
                  )+1
     ),
     "0000000"
)

 

Hope it helps !

Hey @gabibalaban 

Thansk for the quick reply,

This is the code I see when I format the column in Sharepoint.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "box-sizing": "border-box",
    "padding": "0 2px"
  },
  "attributes": {
    "class": "sp-css-backgroundColor-neutralBackground"
  },
  "children": [
    {
      "elmType": "span",
      "style": {
        "line-height": "16px",
        "height": "14px"
      },
      "attributes": {
        "iconName": ""
      }
    },
    {
      "elmType": "span",
      "style": {
        "overflow": "hidden",
        "text-overflow": "ellipsis",
        "padding": "0 3px"
      },
      "txtContent": "[$Title]",
      "attributes": {
        "class": ""
      }
    }
  ]
}


Should I do this is sharepoint or in Powerapps, i'm actually confused.

Hope you can help.

Best regards,
Wahlbang

@wahlbang ,

You actually ask for a solution based on share point column settings option, you’re question is not related to PowerApps app, right ?

@gabibalaban 
Yes, and no, because I and this to be a powerapp based on share point, but I guess you're right.

Hope I don't lost you there.


@wahlbang ,

well, if you use powerapps there are two options to save an item in a share point list:

1. Using a form linked to data source and in this case you need to use my formula inside update property of the Title data card.

2. Using patch () function in a formula like:

Patch(yourListName,Defaults(yourListName),{Title: myAboveFormula, ....})

where ... means the other values you want to save.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,352)