PLM 360 General

Reply
Active Member
Posts: 13
Registered: ‎08-15-2012
Message 1 of 16 (300 Views)
Accepted Solution

Year in Computed Field for autonumbering

300 Views, 15 Replies
01-28-2013 10:32 PM

Hi Support Officer,

 

I am currently setting up a new workspace and I need to make use of the computed field for auto numbering. I need the last 2 digit of the year to appear in between my auto numbering. With the script below, I managed to get MPCR000001 but I really would like the number to be MPCRYY0001 instead. The YY represent the current year and changes whenever a new year arrived.For year 2013, the autonumber will look like this MPCR130001.

 

('MPCR' + dbo.PAD_ZERO(6, convert(varchar,REQUEST_NUMBER__AUTO_INC)))

 

Is there a way to do this? Really appreciate your help and advice.

 

Many thanks.

Carol

Product Support
Posts: 271
Registered: ‎03-27-2012
Message 2 of 16 (285 Views)

Re: Year in Computed Field for autonumbering

01-29-2013 06:56 AM in reply to: MJ-Carol

Carol,

 

Given the limited nature of SQL scripting ( SQL scripting is for all intents and purposes limited for math calculations with in the computed field), this would not be the best way of doing it.

I would suggest using an “on creation script” using JAVASCRIPT (which is much more flexible).



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

New Member
PringaultJ
Posts: 1
Registered: ‎06-17-2011
Message 3 of 16 (259 Views)

Re: Year in Computed Field for autonumbering

02-20-2013 08:10 AM in reply to: MJ-Carol

Carol, Joe, 

 

What you can do on the Field is to put that :

 

('MPCR' + dbo.PAD_ZERO(6, convert(varchar,ID__AUTO_INC)) + CAST(CONVERT (varchar, GETDATE(),101) as CHAR(10)))

 

And for sure you will be abel to play with the convert substring ... function available on SQL

 

Regards & hope this help

 

 



Jeremy PRINGAULT
EMEA Business Consultant
Autodesk
Product Support
Posts: 271
Registered: ‎03-27-2012
Message 4 of 16 (252 Views)

Re: Year in Computed Field for autonumbering

02-20-2013 08:21 AM in reply to: PringaultJ

Jeremy,

 

Good call, didn't think of it that way.



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Active Member
Posts: 13
Registered: ‎08-15-2012
Message 5 of 16 (236 Views)

Re: Year in Computed Field for autonumbering

02-24-2013 06:26 PM in reply to: PringaultJ

Hi Jeremy,

 

Thank you for the solution, really appreciate it.

 

 

Best regards,

Carol Mak

 

Active Contributor
Posts: 50
Registered: ‎04-08-2013
Message 6 of 16 (159 Views)

Re: Year in Computed Field for autonumbering

06-12-2013 08:02 AM in reply to: PringaultJ

Hi I would like to have the same thing.

 

I copied this: ('MPCR' + dbo.PAD_ZERO(6, convert(varchar,ID__AUTO_INC)) + CAST(CONVERT (varchar, GETDATE(),101) as CHAR(10))) on the computed field formula and it said that "Modifications to the computed field formula could not be saved. Check your formula syntax and try again." The data type is Auto Number

 

Can you help me and see what is wrong?

 

Thanks

 

Product Support
Posts: 196
Registered: ‎11-20-2012
Message 7 of 16 (138 Views)

Re: Year in Computed Field for autonumbering

06-13-2013 03:10 PM in reply to: adminplm360

Hi Elias,

 

The value

('MPCR' + dbo.PAD_ZERO(6, convert(varchar,ID__AUTO_INC)) + CAST(CONVERT (varchar, GETDATE(),101) as CHAR(10)))

when entered and saved in my auto number computed field works without error for me.

 

Are you using a different default date format under general display settings? My current default is MM/dd/yyyy.

 

Regards,



Bastien Mazeran
Support Specialist
Product Support
Autodesk, Inc.
Active Contributor
Posts: 50
Registered: ‎04-08-2013
Message 8 of 16 (135 Views)

Re: Year in Computed Field for autonumbering

06-13-2013 03:29 PM in reply to: mazerab
Hi
I have the same date format that you have.
Maybe is the part where it says exclude weekends from duration.
Product Support
Posts: 196
Registered: ‎11-20-2012
Message 9 of 16 (120 Views)

Re: Year in Computed Field for autonumbering

06-14-2013 11:05 AM in reply to: MJ-Carol

Hi Elias,

Could you please try on a laptop instead of an iPad?

Regards,



Bastien Mazeran
Support Specialist
Product Support
Autodesk, Inc.
Active Contributor
Posts: 50
Registered: ‎04-08-2013
Message 10 of 16 (118 Views)

Re: Year in Computed Field for autonumbering

06-14-2013 11:11 AM in reply to: mazerab

I did it in a laptop and it didn't work. I reproduced it in an iPad because I didn't have a laptop at that moment and I wanted to show you the print screen.

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community