kalariviswa

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30
12:01
1871 views
Storing result of each for-each operation in a node set
Hi All,
I have a case , where my input event has multiple roles like <roleinfo>Role1#Role2#Role3<roleinfo>
I have used a node spliter followe by a for each command to assign each of the role.
But during each for each i would like to set a event id say for example 1001 for success and 1002 in case of failure in role assignment. That is for example if Role 1 and 3 assignment is success and Role 2 assignment is failure, then i am looking for a output in a local variable like 1001;1002;1001 , where each node will specify the status of each activity.
To achieve this i had written the below code inside my for-each statement for role assignment , but i am getting only the last event id in the local variable
For Each(roleinfo)
{
Assingrole
if success
Set event id =1001
else
set event id =1002
<do-set-local-variable name="var-event-id-node" scope="driver">
<arg-node-set>
<token-join delimiter=";">
<token-local-variable name="var-event-id"/>
</token-join>
</arg-node-set>
</do-set-local-variable>
}
in the above code the output i am getting is 1001 only. Can some one please help me here.
I have a case , where my input event has multiple roles like <roleinfo>Role1#Role2#Role3<roleinfo>
I have used a node spliter followe by a for each command to assign each of the role.
But during each for each i would like to set a event id say for example 1001 for success and 1002 in case of failure in role assignment. That is for example if Role 1 and 3 assignment is success and Role 2 assignment is failure, then i am looking for a output in a local variable like 1001;1002;1001 , where each node will specify the status of each activity.
To achieve this i had written the below code inside my for-each statement for role assignment , but i am getting only the last event id in the local variable
For Each(roleinfo)
{
Assingrole
if success
Set event id =1001
else
set event id =1002
<do-set-local-variable name="var-event-id-node" scope="driver">
<arg-node-set>
<token-join delimiter=";">
<token-local-variable name="var-event-id"/>
</token-join>
</arg-node-set>
</do-set-local-variable>
}
in the above code the output i am getting is 1001 only. Can some one please help me here.
11 Replies


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30
12:20
kalariviswa wrote:
> <do-set-local-variable name="var-event-id-node" scope="driver">
> <arg-node-set>
> <token-join delimiter=";">
> <token-local-variable name="var-event-id"/>
> </token-join>
> </arg-node-set>
> </do-set-local-variable>
First of all, you seem to be unclear about what a nodeset is and what not.
Token Join produces a String value and takes a Nodeset as input, nevertheless
you give it a String as input and assign it's output to a variable of type
nodeset...
If you want a semi-colon delimited string for output as you described it,
something like this should work:
<do-set-local-variable name="var-event-id-csv-string" scope="driver">
<arg-string>
<token-join delimiter=";">
<token-local-variable name="var-event-id-csv-string"/>
<token-local-variable name="var-event-id"/>
</token-join>
</arg-string>
</do-set-local-variable>
--
http://www.is4it.de/en/solution/identity-access-management/
> <do-set-local-variable name="var-event-id-node" scope="driver">
> <arg-node-set>
> <token-join delimiter=";">
> <token-local-variable name="var-event-id"/>
> </token-join>
> </arg-node-set>
> </do-set-local-variable>
First of all, you seem to be unclear about what a nodeset is and what not.
Token Join produces a String value and takes a Nodeset as input, nevertheless
you give it a String as input and assign it's output to a variable of type
nodeset...
If you want a semi-colon delimited string for output as you described it,
something like this should work:
<do-set-local-variable name="var-event-id-csv-string" scope="driver">
<arg-string>
<token-join delimiter=";">
<token-local-variable name="var-event-id-csv-string"/>
<token-local-variable name="var-event-id"/>
</token-join>
</arg-string>
</do-set-local-variable>
--
http://www.is4it.de/en/solution/identity-access-management/
______________________________________________
https://www.is4it.de/identity-access-management
https://www.is4it.de/identity-access-management
kalariviswa

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30
14:57
Thanks for the quick help.. For the above case , i got an local variable value set as 1001#;#1002#;#1003
I would like to execute a set of conditions if the expression #;# is not present in the local variable var-event-id-node . I think i am some where missing a regular expression. Can you please guide me..
<if-xpath op="not-true">contains($var-event-id-node,"*#;#*")</if-xpath>
I would like to execute a set of conditions if the expression #;# is not present in the local variable var-event-id-node . I think i am some where missing a regular expression. Can you please guide me..
<if-xpath op="not-true">contains($var-event-id-node,"*#;#*")</if-xpath>


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30
15:43
kalariviswa wrote:
> Thanks for the quick help.. For the above case , i got an local variable
> value set as 1001#;#1002#;#1003
>
> I would like to execute a set of conditions if the expression #;# is not
> present in the local variable var-event-id-node . I think i am some
> where missing a regular expression. Can you please guide me..
>
> <if-xpath op="not-true">contains($var-event-id-node,"*#;#*")</if-xpath>
contains() checks for a literal expression, not a regular expression. Therefor
remove the asterisks around the delimiter and it should work just fine. Or use
<if-local-variable mode="regex" name="var-event-id-node"
op="not-equal">.*#;#.*</if-local-variable>
--
http://www.is4it.de/en/solution/identity-access-management/
> Thanks for the quick help.. For the above case , i got an local variable
> value set as 1001#;#1002#;#1003
>
> I would like to execute a set of conditions if the expression #;# is not
> present in the local variable var-event-id-node . I think i am some
> where missing a regular expression. Can you please guide me..
>
> <if-xpath op="not-true">contains($var-event-id-node,"*#;#*")</if-xpath>
contains() checks for a literal expression, not a regular expression. Therefor
remove the asterisks around the delimiter and it should work just fine. Or use
<if-local-variable mode="regex" name="var-event-id-node"
op="not-equal">.*#;#.*</if-local-variable>
--
http://www.is4it.de/en/solution/identity-access-management/
______________________________________________
https://www.is4it.de/identity-access-management
https://www.is4it.de/identity-access-management


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30
16:34
Hi kalariviswa,
contains() will give you right answer (you have delimiter in this
string), but what is your next step?
Your business requirements still not clear for me, but if you need, you
can convert your string 1001#;#1002#;#1003 back to nodeset and use cycle
(For Each) for go thru every string (node) in your nodeset.
--
If you find this post helpful, please show your appreciation by clicking
on the star below :cool:
------------------------------------------------------------------------
al_b's Profile: https://forums.netiq.com/member.php?userid=209
View this thread: https://forums.netiq.com/showthread.php?t=55964
kalariviswa

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-31
13:46
Thanks Al_B, thanks for your comments. I Had followed lhaeger approach and it was successful. Thanks again 🙂 ..
kalariviswa

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-31
13:42
lhaeger;2430196 wrote:
kalariviswa wrote:
> Thanks for the quick help.. For the above case , i got an local variable
> value set as 1001#;#1002#;#1003
>
> I would like to execute a set of conditions if the expression #;# is not
> present in the local variable var-event-id-node . I think i am some
> where missing a regular expression. Can you please guide me..
>
> <if-xpath op="not-true">contains($var-event-id-node,"*#;#*")</if-xpath>
contains() checks for a literal expression, not a regular expression. Therefor
remove the asterisks around the delimiter and it should work just fine. Or use
<if-local-variable mode="regex" name="var-event-id-node"
op="not-equal">.*#;#.*</if-local-variable>
--
http://www.is4it.de/en/solution/identity-access-management/
Thanks So much ...It worked, i was able to store it in a local variable in ITP and call the same variable and check it in OTP. Thanks.


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-31
13:50
kalariviswa wrote:
> Thanks So much ...It worked, i was able to store it in a local variable
> in ITP and call the same variable and check it in OTP. Thanks.
Glad to hear that, just keep in mind that driver scope variables are available
to both subscriber and publisher thread and are persistent between events. So
make sure you do not accidentally use a value from another object or channel...
--
http://www.is4it.de/en/solution/identity-access-management/
> Thanks So much ...It worked, i was able to store it in a local variable
> in ITP and call the same variable and check it in OTP. Thanks.
Glad to hear that, just keep in mind that driver scope variables are available
to both subscriber and publisher thread and are persistent between events. So
make sure you do not accidentally use a value from another object or channel...
--
http://www.is4it.de/en/solution/identity-access-management/
______________________________________________
https://www.is4it.de/identity-access-management
https://www.is4it.de/identity-access-management


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-31
14:27
Lothar Haeger wrote:
> kalariviswa wrote:
>
> > Thanks So much ...It worked, i was able to store it in a local
> > variable in ITP and call the same variable and check it in OTP.
> > Thanks.
>
> Glad to hear that, just keep in mind that driver scope variables are
> available to both subscriber and publisher thread and are persistent
> between events. So make sure you do not accidentally use a value from
> another object or channel...
Also if this information is only required in the current operation, you
should use Operation Data instead of a driver scoped variable.
> kalariviswa wrote:
>
> > Thanks So much ...It worked, i was able to store it in a local
> > variable in ITP and call the same variable and check it in OTP.
> > Thanks.
>
> Glad to hear that, just keep in mind that driver scope variables are
> available to both subscriber and publisher thread and are persistent
> between events. So make sure you do not accidentally use a value from
> another object or channel...
Also if this information is only required in the current operation, you
should use Operation Data instead of a driver scoped variable.
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-06-01
14:48
alexmchugh;2430240 wrote:
Lothar Haeger wrote:
> kalariviswa wrote:
>
> > Thanks So much ...It worked, i was able to store it in a local
> > variable in ITP and call the same variable and check it in OTP.
> > Thanks.
>
> Glad to hear that, just keep in mind that driver scope variables are
> available to both subscriber and publisher thread and are persistent
> between events. So make sure you do not accidentally use a value from
> another object or channel...
Also if this information is only required in the current operation, you
should use Operation Data instead of a driver scoped variable.
This right approach will come with experience: in my oldest drivers I used Driver scoped variables, now I use Operation Property instead. 🙂


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-06-02
09:01
True,
If you end up using Driver scoped variables I always initialize them with a null value such as 0 or '' or even "null" so I know it is empty before setting it. You can also set (remove) it after using it to clean it up. The point is to be careful when using them.
If you end up using Driver scoped variables I always initialize them with a null value such as 0 or '' or even "null" so I know it is empty before setting it. You can also set (remove) it after using it to clean it up. The point is to be careful when using them.
kalariviswa

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-31
13:49
Thanks So much ...It worked, i was able to store it in a local variable in ITP and call the same variable and check it in OTP. Thanks.