Article

anonymous's picture
article
Reads:

3398

Score:
0
0
 
Comments:

0

Generating Unique 8-Character CN's

Author Info

23 May 2007 - 5:50am
Submitted by: anonymous (not verified)

(View Disclaimer)

Problem

A Forum reader recently asked:

"I'm using IDM 3.5 and looking for the best method to generate a CN value that includes:

  • A maximum length of 8 characters
  • The first character of the given name
  • The first character of the initials
  • The surname

The tie-breaker rule is to add a number to the end, and when adding a number to the end it must still be a maximum of 8 characters."

And here's the response from Father Ramon ...

Solution

The example below will give you a 1-digit counter after an initial collision. If you want a counter even when no collision occurs, then get rid of the first pattern. If you want more than one digit, change the counter digits and adjust the substring length in the pattern to match.

<do-set-local-variable name="proposed" scope="policy">
   <arg-string>
     <token-substring length="8">
       <token-substring length="1">
         <token-attr name="Given Name"/>
       </token-substring>
       <token-substring length="1">
         <token-attr name="Inititials"/>
       </token-substring>
       <token-attr name="Surname"/>
     </token-substring>
   </arg-string>
</do-set-local-variable>
<do-set-op-dest-dn>
   <arg-dn>
     <token-unique-name counter-digits="1" counter-pattern="last" 
counter-use="always" name="CN" on-unavailable="error">
       <arg-string>
         <token-local-variable name="proposed"/>
       </arg-string>
       <arg-string>
         <token-substring length="7">
           <token-local-variable name="proposed"/>
         </token-substring>
       </arg-string>
     </token-unique-name>
   </arg-dn>
</do-set-op-dest-dn>


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell