cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Harpreet_Tohra
Frequent Visitor

Creating process Id starts from 000001

Hi I am trying to create  6 digit unique autoincrement  Process Id starting from 000001 to.... In power canvas app on create button and save it to SharePoint list. On create button it should check sharepoint last ID and auto increment it by 1 and show it on form and then update new on create button of form. But unfortunately it is showing 1 instead of 0000001 ..........

Can anybody plz help me to resolve this????

Thanks in advance 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Harpreet_Tohra 

We need to wrap First(Sort(... in Text( to convert it to a text value that can be concatenated.  Try this

 

 

With(
    {
        newID: Right(
            Concatenate(
                "000000",
                Text(
                    First(
                        Sort(
                            'SRD data',
                            'Process ID',
                            Descending
                        )
                    ).'Process ID' + 1,
                    "######"
                )
            ),
            6
        )
    },
    If(
        IsBlank(Parent.Default),
        newID,
        Parent.Default
    )
)

 

 

Or get rid of the Concatenate and just use

 

With(
    {
      newID: Right(
                   "000000" & First(
                                     Sort(
                                          'SRD data','Process ID',Descending
                                      )
                               ).'Process ID' + 1,
                     6
               )
    },
    If(
        IsBlank(Parent.Default),
        newID,
        Parent.Default
    )
)

 

If the form is New, Parent.Default will be blank.  This formula can be used for the Default value of a textbox control in the 'Process ID' card or as the Update property of the card.  I would either hide this card or make it disabled so users can't change it. 

 

View solution in original post

4 REPLIES 4
Drrickryp
Super User II
Super User II

Right(Concatenate("0000000", First(Sort(SPlist,ID,Descending)).ID+1),6)

Capture.PNG

Hi @Drrickryp  Thanks for Replying.

I tried this but unfortunately it is giving me some error. It would be great if you could help me to solve this.

If(Form1.Mode=FormMode.New,Right(Concatenate("000000",First(Sort('SRD data','Process ID',Descending)).'Process ID'+1),6))
Getting error on Concatenate and First in the code.

Thanks in advance

Hi @Harpreet_Tohra 

We need to wrap First(Sort(... in Text( to convert it to a text value that can be concatenated.  Try this

 

 

With(
    {
        newID: Right(
            Concatenate(
                "000000",
                Text(
                    First(
                        Sort(
                            'SRD data',
                            'Process ID',
                            Descending
                        )
                    ).'Process ID' + 1,
                    "######"
                )
            ),
            6
        )
    },
    If(
        IsBlank(Parent.Default),
        newID,
        Parent.Default
    )
)

 

 

Or get rid of the Concatenate and just use

 

With(
    {
      newID: Right(
                   "000000" & First(
                                     Sort(
                                          'SRD data','Process ID',Descending
                                      )
                               ).'Process ID' + 1,
                     6
               )
    },
    If(
        IsBlank(Parent.Default),
        newID,
        Parent.Default
    )
)

 

If the form is New, Parent.Default will be blank.  This formula can be used for the Default value of a textbox control in the 'Process ID' card or as the Update property of the card.  I would either hide this card or make it disabled so users can't change it. 

 

View solution in original post

@Drrickryp It worked. Thanks Sir

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (38,368)