cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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.

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

Community Champion
Community Champion

Hi @ENE

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

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,425)