Anonymous_User Absent Member.
Absent Member.
226 views

separate givenName in 3 lines and convert them to lowercase?


I am using idm4.0.1a in Suse 11 Sp1.
remote loader runs in windows 2003.

I have the givenName attribute recroded the name as YUEN YEE ANNIE, I
have to put them into 3 lines and convert them to lower case, that
means:

yuen
yee
annie

Would anyone please help?

Many thanks & Regards,

Agnes


--
ayeungied
------------------------------------------------------------------------
ayeungied's Profile: https://forums.netiq.com/member.php?userid=548
View this thread: https://forums.netiq.com/showthread.php?t=44961

Labels (1)
0 Likes
9 Replies
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?


Sorry,

There should be a comma among the givenName, that means: YUEN YEE,
ANNIE

thanks.

Agnes


--
ayeungied
------------------------------------------------------------------------
ayeungied's Profile: https://forums.netiq.com/member.php?userid=548
View this thread: https://forums.netiq.com/showthread.php?t=44961

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?

On 16.10.2012 08:14, ayeungied wrote:
>
> Sorry,
>
> There should be a comma among the givenName, that means: YUEN YEE,
> ANNIE
>
> thanks.
>


Assuming you mean that you want to reformat this into three lines (still
one attribute). I'd do it like this.

<rule>
<description>Split operation attribute Given Name to three
lines</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="linebreak" scope="policy">
<arg-string>
<token-xpath
expression="java.lang.System:getProperty('line.separator')"/>
</arg-string>
</do-set-local-variable>
<do-reformat-op-attr name="Given Name">
<arg-value type="string">
<token-replace-all regex="([^\s]+)\s+([^,]+),\s*(.+)"
replace-with="$1$linebreak$$2$linebreak$$3">
<token-local-variable name="current-value"/>
</token-replace-all>
</arg-value>
</do-reformat-op-attr>
</actions>
</rule>

0 Likes
Knowledge Partner
Knowledge Partner

Re: separate givenName in 3 lines and convert them to lowercase?

On 10/16/2012 4:14 AM, Alex McHugh wrote:
> On 16.10.2012 08:14, ayeungied wrote:
>>
>> Sorry,
>>
>> There should be a comma among the givenName, that means: YUEN YEE,
>> ANNIE


Alex,
That is a great example of using Regex capture groups.

Could I recommend you explain a bit how they work, and then convert it
into an article to submit?

This is one of those non-obvious things you can do with Regex in IDM.



> Assuming you mean that you want to reformat this into three lines (still
> one attribute). I'd do it like this.
>
> <rule>
> <description>Split operation attribute Given Name to three
> lines</description>
> <conditions>
> <and/>
> </conditions>
> <actions>
> <do-set-local-variable name="linebreak" scope="policy">
> <arg-string>
> <token-xpath
> expression="java.lang.System:getProperty('line.separator')"/>
> </arg-string>
> </do-set-local-variable>
> <do-reformat-op-attr name="Given Name">
> <arg-value type="string">
> <token-replace-all regex="([^\s]+)\s+([^,]+),\s*(.+)"
> replace-with="$1$linebreak$$2$linebreak$$3">
> <token-local-variable name="current-value"/>
> </token-replace-all>
> </arg-value>
> </do-reformat-op-attr>
> </actions>
> </rule>
>


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?

On 16.10.2012 14:07, Geoffrey Carman wrote:
> Alex,
> That is a great example of using Regex capture groups.
>
> Could I recommend you explain a bit how they work, and then convert it
> into an article to submit?
>
> This is one of those non-obvious things you can do with Regex in IDM.


Haven't you already covered Regex capture groups in
http://www.novell.com/communities/node/13126/common-mistakes-newcomers-idm-make-part-5

There is of course a lot more that can be done with regex & capture
groups - but as you said in that article - there are plenty of great
(non IDM specific) regex resources out there on the web.
0 Likes
Knowledge Partner
Knowledge Partner

Re: separate givenName in 3 lines and convert them to lowercase?

On 10/17/2012 7:43 AM, Alex McHugh wrote:
> On 16.10.2012 14:07, Geoffrey Carman wrote:
>> Alex,
>> That is a great example of using Regex capture groups.
>>
>> Could I recommend you explain a bit how they work, and then convert it
>> into an article to submit?
>>
>> This is one of those non-obvious things you can do with Regex in IDM.

>
> Haven't you already covered Regex capture groups in
> http://www.novell.com/communities/node/13126/common-mistakes-newcomers-idm-make-part-5
>
>
> There is of course a lot more that can be done with regex & capture
> groups - but as you said in that article - there are plenty of great
> (non IDM specific) regex resources out there on the web.


Different perspective is still of value.

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?


Alex,

Thank you.

After see your coding, I have no idea in how to ssign the Given Name
values in 3 different lines to an AD multi-value attribute named
otherPager

That means:

Add destination attribute value - otherPager to yuen
Add destination attribute value - otherPager to yee
Add destination attribute value - otherPager to annie

Sorry, as I am a layman of program, would you mind to describe your
coding in detail?

Thousands of Thanks & Regards,

Agnes


--
ayeungied
------------------------------------------------------------------------
ayeungied's Profile: https://forums.netiq.com/member.php?userid=548
View this thread: https://forums.netiq.com/showthread.php?t=44961

0 Likes
jtl1 Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?

Do you mean 3 separate values, not three lines?

If the source value is YUEN YEE,ANNIE the following regex can be used to capture the three values:
([^\s]+)\s([^,]+),(.+)

The following code is a good start for your rule. You might consider adding more validation and you might need to make minor
changes:
<rule>
<description>Split operation attribute Given Name to three values</description>
<conditions>
<and>
<if-op-attr name="Given Name" op="available"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="givenName" scope="policy">
<arg-string>
<token-op-attr name="Given Name"/>
</arg-string>
</do-set-local-variable>
<do-strip-op-attr name="Given Name"/>
<do-set-dest-attr-value name="Given Name">
<arg-value type="string">
<token-lower-case>
<token-replace-all regex="([^\s]+)\s([^,]+),(.+)" replace-with="$1">
<token-local-variable name="givenName"/>
</token-replace-all>
</token-lower-case>
</arg-value>
</do-set-dest-attr-value>
<do-add-dest-attr-value name="Given Name">
<arg-value type="string">
<token-lower-case>
<token-replace-all regex="([^\s]+)\s([^,]+),(.+)" replace-with="$2">
<token-local-variable name="givenName"/>
</token-replace-all>
</token-lower-case>
</arg-value>
</do-add-dest-attr-value>
<do-add-dest-attr-value name="Given Name">
<arg-value type="string">
<token-lower-case>
<token-replace-all regex="([^\s]+)\s([^,]+),(.+)" replace-with="$3">
<token-local-variable name="givenName"/>
</token-replace-all>
</token-lower-case>
</arg-value>
</do-add-dest-attr-value>
</actions>
</rule>

Best regards,
Tobias
On 2012-10-16 06:14, ayeungied wrote:
>
> I am using idm4.0.1a in Suse 11 Sp1.
> remote loader runs in windows 2003.
>
> I have the givenName attribute recroded the name as YUEN YEE ANNIE, I
> have to put them into 3 lines and convert them to lower case, that
> means:
>
> yuen
> yee
> annie
>
> Would anyone please help?
>
> Many thanks & Regards,
>
> Agnes
>
>


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?


There's a lot of ways to skin this cat and I've had to do something
recently that was similar. In my example below, I extract the Surname
from the Full Name attribute by taking advantage of the Split token into
a node-set:


<rule>
<description>Provide a required Surname for new Users.</description>
<comment xml:space="preserve">For the required Surname field, try to
use the NAME field from Top Secret. Otherwise, assign it the value of
the Association.</comment>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
</and>
</conditions>
<actions>
<do-if>
<arg-conditions>
<and>
<if-attr name="Full Name" op="available"/>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="name-node-set" scope="policy">
<arg-node-set>
<token-split delimiter=" ">
<token-attr name="Full Name"/>
</token-split>
</arg-node-set>
</do-set-local-variable>
<do-add-dest-attr-value name="Surname">
<arg-value type="string">
<token-xpath expression="$name-node-set[last()]"/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
<arg-actions>
<do-add-dest-attr-value name="Surname">
<arg-value type="string">
<token-association/>
</arg-value>
</do-add-dest-attr-value>
</arg-actions>
</do-if>
</actions>
</rule>


For your case, you could reference $name-node-set[1], $name-node-set[2]
and $name-node-set[3].


--
jgrieshop
------------------------------------------------------------------------
jgrieshop's Profile: https://forums.netiq.com/member.php?userid=483
View this thread: https://forums.netiq.com/showthread.php?t=44961

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: separate givenName in 3 lines and convert them to lowercase?


thank you Tobias.


--
ayeungied
------------------------------------------------------------------------
ayeungied's Profile: https://forums.netiq.com/member.php?userid=548
View this thread: https://forums.netiq.com/showthread.php?t=44961

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.