Feature Friday: Scripting Secrets in PLM 360
OK, so maybe not really secrets, but you guys know I love alliteration! On April 2nd, Brian Schanen and I will be covering some tips, tricks, and best practices around scripting during our PLM Talk technical webinar. A great tip was outlined on our Discussion Forum this week as to how to tweak an existing script in PLM 360. This involves how to use a sequencer to create part or document numbers in a workspace. Borrowing from the great instructions Brian Roepke provided on the forum, here’s what you need to do:
- Go to the workspace “Sequencers” (in the Reference area of the main menu)
- Create a new item. Fill it out with the rules that you want to follow for the numbering.
- Next you need to create a new action script. Call it something like “DocNumbering” or similar
- In the “Imports” area of the script you need to add “sequenceOperator” to the script or this wont work…
- Take the code below and paste it in.
var itemSeqID = ‘332’;
//set the new number
var newItemNumber = nextSeqNumber(itemSeqID);
item.NUMBER = newItemNumber;
- Next you need to modify that code. You need to edit the number (332) at the beginning to be the number that’s listed in the “Seq ID” field on the item record you created in step 2. You can see in my image below it’s 1526.
- You also need to ensure that “item.NUMBER” called out above in the final line is in fact the name of your field. (NUMBER)
- Finally – Got to your workspace and the “Behaviors” section. Here you need to add the “Create” behavior to be the script you just created.
Now when I create a new record, the sequencer number appears! If this is a revision controlled workspace, it won’t change when it’s revised.
Don’t forget to register for our PLM Talk “Scripting Secrets” (Wednesday 4/02/2014) to learn more about scripting in PLM 360.