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

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
Highlighted
Community Champion
Community Champion

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

Highlighted
Advocate V
Advocate V

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.

New Member

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.

Highlighted
Community Champion
Community Champion

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,008)