cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Lucas
Level: Powered On

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
Meneghino
Level 10

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

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
Meneghino
Level 10

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

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

Lucas
Level: Powered On

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

Hi @Meneghino,

 

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

ENE
Level: Power Up

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

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

Meneghino
Level 10

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

Hi @ENE

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 278 members 5,686 guests
Please welcome our newest community members: