≡ Menu

How To Use Naming Rules

Share the knowledge


You know what? Users are a pain in the butt. An awful lot of the work that goes into setting up Teamcenter is directed towards preventing users from making too big of a mess of things. And the very first thing that users will try to do to screw up your database is to mess around with the part numbers they assign to data. If a part number is supposed to be XXXX-YYYY, and you don’t have the proper controls in place, you’ll be pretty lucky if you don’t end up with thirteen variations of it: XXXX-YYYY, XXXX_YYYYY, CURLY.XXXX-YYYY, LARRY.XXXX-YYYY, MOE.XXXX-YYYY, XXXX-YYYY.REWORK, my_left_bracket.XXXX-YYYY, projectZ.XXXX-YYYY, etc. etc. ad infinitum, ad nauseam.

I know because I’ve had to deal with the mess users have created, and because I used to be one of those users who contributed to the mess. (doh!)

So, what kind of proper controls can you put in place? Well, keep reading…

As you might guess, there isn’t a single, one-size-fits all solution. There are three types of solutions which I have utilized myself. Which one, or which combination, you use depends on the nature of what you need to enforce and how much convenience and automation you want to supply to your users. I love to complain about users as much as anyone, but frankly, a good solution shouldn’t just focus on slapping them on the wrist; it should also try to help them do their job more efficiently.

The three solutions I’ve used are:

  1. Naming Rules
  2. User exits
  3. pre-conditions

Naming Rules

These will likely be your first line of defense. Naming rules allow you to define one or more patterns which constitute a valid item ID. The syntax for defining the patterns allows for some pretty complex patterns. A naming rule may refer to other naming rules, Lists of Values (LOV), system variables, or use regular expressions. You define them from within the BMIDE application and then attach them to Business Object properties; typically item_id.

Even if you limit yourself to only using Naming Rules, there are a many ways you could define them. For example, say that you wanted to set up a naming rule that allowed part numbers that began with the letter A, B, C or D, and was followed by four numeric digits. There are a few ways to define the naming rule:
(disclaimer: I’m not actually creating these rules, deploying them to a test instance of Teamcenter, and verifying them. So my syntax may not be 100% correct in each case. Still, it’s close enough to make the point)

  1. You could explicitly list out all of the possible patterns:
     "A"nnnn "B"nnnn "C"nnnn "D"nnnn 
  2. You could, perhaps at the expense of clarity, define it with a single regular expression:
     %[ABCD][0-9]{4}$ 
  3. If you wanted to use the same set of four prefix letters in multiple naming rules, you could define it as it’s own naming rule and then refer to it from the other naming rules:
     prefix_naming_rule := "A" "B" "C" "D" part_number_naming_rule_1 := {RULE:prefix_naming_rule}nnnn part_number_naming_rule_2 := {RULE:prefix_naming_rule}nnnn-nnnn 

    In this case the Naming Rule, prefix_naming_rule, wouldn’t actually be attached to any attributes. It only exists to build up other naming rules.

  4. And finally, if the prefix was something that you wanted to reference from other parts of the data model — say it defines the list of possible values for some attribute, you could define the prefix as a LOV and then refer to that within your naming rule:
     {LOV:prefix_lov}nnnn 

    Auto Generation

    In addition, naming rules allow you to define one or more patterns which will auto-generate new part numbers when users click an Assign button. This is new in TCUA; Teamcenter Engineering only allowed you to define one pattern which could be used to auto-generate numbers. Now the TCUA rich client will allow you to pick which of the naming rules for which there are auto-generate counters defined. Unfortunately, so far NX 7.5 isn’t hasn’t caught up; If you create a file from within NX and click the Assign button you can only get a number from the first pattern listed in the Naming Rule.

    Naming Rule Limitations

    The limitations of naming rules are that they only allow a simple Pass/Fail result, they cannot modify the attempted part number except to change the case to either upper or lowercase, and they don’t allow you to make any semantic checks, e.g. “the number is valid if it matches this pattern AND some other condition in the database is also True.” Also, setting up counters to auto-generate part numbers only works with the simple naming rule patterns, “A”nnnnn, for example. Naming rules that contain regular expressions or refer to other naming rules or LOVs cannot be used to auto-generate IDs. And finally, the error message reported to users basically just shows then the definition of the naming rule they violated. So, expect that users will be confused by the error messages they get if your patterns at all complicated.

    To be continued…

    That’s enough for now. Tune in next time when I get into the codeful customizations you can do with user exits and pre-conditions.

  • A George Gunendran

    I like the naming rules, but Teamcneter 8.3 has a bug in handling the naming rule pattern: N-NNN-NNN-NNN. This pattern worked fine for us with 2007.1.5, but 8.3 behaves strangely!!!

    • http://plmdojo.com Scott Pigman

      aw, c’mon now, you can’t just hit and run like that 😉 What’s behaving strange? The validation or the auto-generation? now you’ve got me curious.

      • A George Gunendran

        Hi Scott,

        Thank you for the comments & your curiosity.
        This issue is now escalated as PR. If you really need the PR number, please
        mail me ([email protected]).

        Actually our item numbers are defined with pattern
        string N-NNN-NNN-NNN in TC2007 and working perfectly.

        Now I am testing the Teamcenter upgrade in test environment and identified the issue. Once i have upgraded to 8.3, it generates
        the item numbers as follows:

        Last 3 digits in an incremental order. The 1st
        & 2nd sets of ‘3-digit number’ come as {last 3-digit number +1}.

        For Example:

        First Item: 1-002-002-001
        2nd Item: 1-003-003-002
        3rd Item: 1-004-004-003

        This has been proved as an error/ bug in Teamcenter
        8.3.

        I would be very glad, if you could provide me any
        work around for this issue.

        Thanks

        George
        [edited to remove extra blank lines — moderator]

        • http://plmdojo.com Scott Pigman

          Well, that certainly is an annoying bug.

          As a temporary fix could you define your pattern as something like "0-000-000-"nnn and then when that sequence runs out update the fixed string to "0-000-001-"nnn?

          If the correct sequence is too complicated for that, the next thing would be to write some ITK code to create your own user exit for generating the correct sequence (see the related post on User Exits for that).

          By the way, this would be a good topic to bring up on the TCUA forum at http://plmworld.org. You’ll get a lot more eyes on the problem and there’s some smart people who participate there.

          • A George Gunendran

            Thank you for the comments. I have heard from GTAC that the issue will be addressed in patch 8.3.2.2.4 (by mid November).

  • Pingback: Teamcenter User Exits | ITK | The PLM DojoThe PLM Dojo()

  • Pingback: How to Control Part Numbers with User Exits | The PLM Dojo()

  • Luciano

    Very nice topic. I’m trying to create more “specific” IDs for my components and finished products but so far with the actual Naming Rules is it not possible. Maybe with some ITK code.

  • Teamcenter Heretic

    Can you provide a bit more info on what you are trying to accomplish?

    Name rules are mostly for validation, not assignment.

    Witness the more complex Regex type rules that cannot b used with counters:

    %^[A-Z0-9][A-Z0-9 -]{1,}$

    %(^5001.*$|^5002.*$|^5003.*$|^5004.*$)

    %^[^>]+$

    or %^[A-Z0-9][A-Z0-9-]-{1,25}$

    The last one should only allow upper case when attached to the item_id property but instead allows mixed.

    Consider that I once had to do this:

    ?
    ??
    ???
    ????
    ……
    ????????????????????????????????????????????????????????????????????????????????????????????????????

    just because the UpperCase conversion doesn’t happen on RegEx rules…

    That is 50 lines of rule!!!!

    Plus when your user violates the rule they are shown this:

    %^[A-Z0-9][A-Z0-9-]-{1,25}$

    Rather than the rule description of: “Max 25 upper case alphanumeric (optionally followed by a dash.”

    so many opportunities for improvement 😉

  • Steve

    So would this help for the problem we are having then? Specific GM PLM part numbers are not accepted in TEAMCENTER when uploading. How can i fix this problem? -Steve Charles – Special Projects Manager-

    • http://plmdojo.com/ Scott Pigman

      Hi Steve,
      I’m guessing that one of two things is the problem. Either you have naming rules implemented but they don’t account for certain part numbers, or you’re trying to upload an item with an ID that already exists.

      If it’s a naming rule problem your options are to either modify the naming rules or set the NR_BYPASS preference and import as a DBA, which will allow you to bypass the naming rule check (see here: http://plmdojo.com/admin/10-teamcenter-preferences-you-should-know).

      If it’s an item ID collision that you’ll either have to modify the new item ID somehow, typically by adding a prefix or a suffix, or if you’re on TC 10 or later implement the Multi-Field Key functionality (see here: http://plmdojo.com/admin/10-teamcenter-preferences-you-should-know).

      Hope this helps. If it doesn’t, tell us a bit more about the specific error message you’re seeing.

      Regards,

      Scott

  • Steve

    Hi. I haven’t started my new management position yet so. In candid conversation with the G.M., one of the first tasks for myself will be investigating their dilemma with the PLM/ TEAMCENTER part naming problem. More to come. Will know more after March 24th. Wish me luck. Last time I was even associated with TEAMCENTER / PLM was 2006! Can’t wait. -Steve-

  • Matt Martin

    Scott, has there been any progress on NX honoring Tc naming rules from the NX File > New or File > SaveAs? This behavior forces me to use the Rich Client to create new items or even revise existing. I’d like to be able to use just NX Manager with no Rich Client for certain users.

Optimization WordPress Plugins & Solutions by W3 EDGE