Highlighted
Anonymous_User Absent Member.
Absent Member.
181 views

do-set-local-variable spoce ?


How is the "scope" supposed to work with "do-set-local-variable" ?

If I sets a local variable with a policy scope
and then
sets the same local variable name but with a driver scope

Then my local variable contains my first variable.

Is it supposed to work like this in 4.0.2 ?

Regards Magnus .. .


Code:
--------------------

<rule>
<description>Test</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="xx" scope="policy">
<arg-string>
<token-text xml:space="preserve">xx</token-text>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="xx" scope="driver">
<arg-string>
<token-text xml:space="preserve">XX</token-text>
</arg-string>
</do-set-local-variable>
<do-trace-message>
<arg-string>
<token-local-variable name="xx"/>
</arg-string>
</do-trace-message>
</actions>
</rule>

--------------------


--
magnus
------------------------------------------------------------------------
magnus's Profile: https://forums.netiq.com/member.php?userid=283
View this thread: https://forums.netiq.com/showthread.php?t=46183

Labels (1)
0 Likes
4 Replies
Knowledge Partner
Knowledge Partner

Re: do-set-local-variable spoce ?

On 11/16/2012 10:04 AM, magnus wrote:
>
> How is the "scope" supposed to work with "do-set-local-variable" ?
>
> If I sets a local variable with a policy scope
> and then
> sets the same local variable name but with a driver scope
>
> Then my local variable contains my first variable.
>
> Is it supposed to work like this in 4.0.2 ?


No, it should have overwritten the value on the second set local variable.


> Regards Magnus .. .
>
>
> Code:
> --------------------
>
> <rule>
> <description>Test</description>
> <conditions>
> <and/>
> </conditions>
> <actions>
> <do-set-local-variable name="xx" scope="policy">
> <arg-string>
> <token-text xml:space="preserve">xx</token-text>
> </arg-string>
> </do-set-local-variable>
> <do-set-local-variable name="xx" scope="driver">
> <arg-string>
> <token-text xml:space="preserve">XX</token-text>
> </arg-string>
> </do-set-local-variable>
> <do-trace-message>
> <arg-string>
> <token-local-variable name="xx"/>
> </arg-string>
> </do-trace-message>
> </actions>
> </rule>
>
> --------------------
>
>


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: do-set-local-variable spoce ?


ok. thanks.. I'll report a defect .


--
magnus
------------------------------------------------------------------------
magnus's Profile: https://forums.netiq.com/member.php?userid=283
View this thread: https://forums.netiq.com/showthread.php?t=46183

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: do-set-local-variable spoce ?

Geoffrey Carman wrote:

> > If I sets a local variable with a policy scope
> > and then
> > sets the same local variable name but with a driver scope
> >
> > Then my local variable contains my first variable.
> >
> > Is it supposed to work like this in 4.0.2 ?

>
> No, it should have overwritten the value on the second set local variable.


I beg to differ: policy and driver scoped vars of the same name can exist in
parallel, but the policy-scoped one has a higher priority than the
driver-scoped one when unsing token-local-variable. Kind of similar to GCVs
defined on driver and driverset, or GCVs and local vars when using the $var$
expansion type. Overall priority order (low-high) would be:

lower weight driverset resource GCV
higher weight driverset resource GCV
driverset object GCV
lower weight driver resource GCV
higher weight driver resource GCV
driver object GCV
driver-scoped local var
policy-scoped local var

Not all token/expansion methods can access all of those values, but keep the
relative order in the subsets they can access: token-global-variable and ~GCV~
expansion for all GCVs, token-local-varioable for both types of local var and
$gcv/var$ expansion for all of them. At least that's what I always assumed,
though I cannot find it in the docs right now (like so many important
details...)

Cheers, Lothar

--

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: do-set-local-variable spoce ?

Lothar Haeger wrote:

> I beg to differ: policy and driver scoped vars of the same name can exist in
> parallel, but the policy-scoped one has a higher priority than the
> driver-scoped one when unsing token-local-variable.


Funny that it hits me just a few days after posting the above:

[11/21/12 18:39:25.337]:Test ST: Action:
do-set-local-variable("current-target",scope="policy",token-xpath("$current-node
/@target-attr")).
[11/21/12 18:39:25.337]:Test ST:
arg-string(token-xpath("$current-node/@target-attr"))
[11/21/12 18:39:25.337]:Test ST:
token-xpath("$current-node/@target-attr")
[11/21/12 18:39:25.338]:Test ST: Token Value:
"managerWorkforceID".
[11/21/12 18:39:25.338]:Test ST: Arg Value:
"managerWorkforceID".
[...]
[11/21/12 18:39:25.357]:Test ST: Action:
do-set-local-variable("current-target",scope="driver",token-local-variable("curr
ent-node")).
[11/21/12 18:39:25.358]:Test ST:
arg-string(token-local-variable("current-node"))
[11/21/12 18:39:25.358]:Test ST:
token-local-variable("current-node")
[11/21/12 18:39:25.358]:Test ST: Token Value: "Group
Membership".
[11/21/12 18:39:25.358]:Test ST: Arg Value: "Group
Membership".
[...]
[11/21/12 18:39:25.359]:Test ST: Action:
do-add-dest-attr-value("$current-target$",direct="true",token-local-variable("cu
rrent-node")).
[11/21/12 18:39:25.360]:Test ST: Expanded variable
reference '$current-target$' to 'managerWorkforceID'.
[11/21/12 18:39:25.360]:Test ST:
arg-string(token-local-variable("current-node"))
[11/21/12 18:39:25.360]:Test ST:
token-local-variable("current-node")
[11/21/12 18:39:25.360]:Test ST: Token Value:
"\DEV-TREE\data\idm\groups\OU02".
[11/21/12 18:39:25.360]:Test ST: Arg Value:
"\DEV-TREE\data\idm\groups\OU02".

Took me while to figure out why the group membership would not be set...
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.