Novell is now a part of Micro Focus

Extracting a Second Entry in a Multi-Valued Attribute

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 1 Aug 2007


A Forum reader recently asked:

"For a long time I have used the "Other Name", which is second entry of a multi-valued CN for storing a Student number. Now I want to move it to a separate attribute. I tried an IDM 3.5 loopback driver, but I cannot fetch the second attribute. I always get back the naming part of the CN attribute. Any ideas?"

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


You haven't said how you are trying to get the attribute, but typically you would get back all values. However, if you were trying to use it as a single value, you would get whichever was the first one to be returned, which may or may not be the naming value. The easiest way to distinguish between the two is that the value element for the naming value will have naming="true" attribute attached to it. So, something like the following would probably do what you want:

  <description>non-naming cn</description>
   <do-set-local-variable name="cn" scope="policy">
     <token-src-attr name="CN"/>
     <token-xpath expression="$cn[not(@naming = 'true')]"/>
     <do-set-src-attr-value name="newattr">
       <token-local-variable name="current-node"/>
     <do-remove-src-attr-value name="CN">
       <token-local-variable name="current-node"/>

Aaron Burgemeister adds:

Why not get all values in that attribute and remove the one that is part of the DN? That would seem to be the easy way to find the naming attribute, regardless of its position. Perhaps you could use a "for-each" approach ...

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates