cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

Can you set a format for the AutoNumber in you CDS?

Hello,

 

I'm working with a Purchase Order entity  from my CDS that is conected to my app, that entity has previuos data created by microsoft and their AutoNumber format was "PO001". When I started to add data to it I saw the AutoNumber format change to "Pur000001".

 

I was wondering if there is a way to control or manipulate this format ?

 

Also, I wanted to match this AutoNumber in the existing records to the codification we already have and let the AutoNumber keep the sequence for the new orders.

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Hi @Lucas

 

In my personal opinion there are two things in PowerApps that should be used only if very little customisation is required: forms and standard entities.  This is because as soon as you want to do any real customisation, then it is much easier to start from zero.

 

In your case, I would create a custom entity.  You can then set the prefix of the PrimaryId to be PO, altough you will still see 6 digits after the prefix, so "PO000001".  You can always show the shortened version in PowerApps by chopping out three zeros with a Substitute, something like this:

Substitute(ThisItem.PrimaryId, "000", "")

You can use your existing codification by opening the entity in Excel and copy-pasting the exisintg codification (but with 6 digits) in the PrimaryId column.  I have tested in the past and it worked.

View solution in original post

4 REPLIES 4
Highlighted
Community Champion
Community Champion

Hi @Lucas

 

In my personal opinion there are two things in PowerApps that should be used only if very little customisation is required: forms and standard entities.  This is because as soon as you want to do any real customisation, then it is much easier to start from zero.

 

In your case, I would create a custom entity.  You can then set the prefix of the PrimaryId to be PO, altough you will still see 6 digits after the prefix, so "PO000001".  You can always show the shortened version in PowerApps by chopping out three zeros with a Substitute, something like this:

Substitute(ThisItem.PrimaryId, "000", "")

You can use your existing codification by opening the entity in Excel and copy-pasting the exisintg codification (but with 6 digits) in the PrimaryId column.  I have tested in the past and it worked.

View solution in original post

Hi @Meneghino,

 

Thank you for the information on the prefix, also, the substitue function is a great alternative to shortened the 6 digits number.

Highlighted

Substitute does not work as it can be implemented for Text field only, but not for INT.

Highlighted
Community Champion
Community Champion

Hi @ENE

The PrimaryId field in CDS is a text field, I believe.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,719)