Eswar Donda

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-01
12:33
1176 views
Multi Valued attribute returning values as single String.
Hello All,
I am using Loop Back driver to send email notification to users when the roles assigned to them are about to expire. In the email I need to Publish Role CN, Expiry date and nrfRoleCategorykey (multi-valued attribute in the role). For each role I am fetching nrfRoleCategorykey value using query, as it is multi-valued attribute it is giving all the values as a single concatenated string without any delimiter example as below:
nrfroleCategoryKey: AlphaBetaDelta……. etc.
I want these values with some delimiter as (Alpha, Beta, Delta,...etc).
Below is the code i am using:
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-text xml:space="preserve"/>
</arg-string>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="varRoleCatogeryKey"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-local-variable name="varMultipleRoleCatKeys"/>
<token-text xml:space="preserve">,</token-text>
<token-local-variable name="current-node"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-for-each>
=======================================================================================
Part of Trace:
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Action: do-set-local-variable("varMultipleRoleCatKeys",scope="policy",token-local-variable("varMultipleRoleCatKeys")+","+token-local-variable("current-node")).
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: arg-string(token-local-variable("varMultipleRoleCatKeys")+","+token-local-variable("current-node"))
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-local-variable("varMultipleRoleCatKeys")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Token Value: "".
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-text(",")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-local-variable("current-node")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Token Value: "AlphaBetaDelta".
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Arg Value: ",AlphaBetaDelta".
==============================================
current Node is returning value as "AlphaBetaDelta" .
Some one help me on this how to achieve these values as Alpha,Beta,Delta.
Regards,
Eswar
I am using Loop Back driver to send email notification to users when the roles assigned to them are about to expire. In the email I need to Publish Role CN, Expiry date and nrfRoleCategorykey (multi-valued attribute in the role). For each role I am fetching nrfRoleCategorykey value using query, as it is multi-valued attribute it is giving all the values as a single concatenated string without any delimiter example as below:
nrfroleCategoryKey: AlphaBetaDelta……. etc.
I want these values with some delimiter as (Alpha, Beta, Delta,...etc).
Below is the code i am using:
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-text xml:space="preserve"/>
</arg-string>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-local-variable name="varRoleCatogeryKey"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-local-variable name="varMultipleRoleCatKeys"/>
<token-text xml:space="preserve">,</token-text>
<token-local-variable name="current-node"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-for-each>
=======================================================================================
Part of Trace:
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Action: do-set-local-variable("varMultipleRoleCatKeys",scope="policy",token-local-variable("varMultipleRoleCatKeys")+","+token-local-variable("current-node")).
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: arg-string(token-local-variable("varMultipleRoleCatKeys")+","+token-local-variable("current-node"))
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-local-variable("varMultipleRoleCatKeys")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Token Value: "".
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-text(",")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: token-local-variable("current-node")
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Token Value: "AlphaBetaDelta".
[05/31/17 11:35:23.732]:Loopback Driver Roles Exp Notification ST: Arg Value: ",AlphaBetaDelta".
==============================================
current Node is returning value as "AlphaBetaDelta" .
Some one help me on this how to achieve these values as Alpha,Beta,Delta.
Regards,
Eswar
13 Replies


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-01
12:47
You are dealing with a nodeset, so I would use a foreach to iterate over
the values, appending to the local variable each iteration, thus creating
the resulting val0,val1,val2 string that you want. Otherwise, I think
what you are trying to do, treating the elements of the nodeset as
individual strings in this context, is invalid.
--
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.
If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.
the values, appending to the local variable each iteration, thus creating
the resulting val0,val1,val2 string that you want. Otherwise, I think
what you are trying to do, treating the elements of the nodeset as
individual strings in this context, is invalid.
--
Good luck.
If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.
If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.
Eswar Donda

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-02
08:36
Thank you for the reply,
Even i tried with for each loop, if you look into the trace i posted the current node is returning the value as concatenated string. i.e, The result value of query is returning as concatenated string like "alphaBetaDelta"(in both the case - set as node-set or string).
Even i tried with for each loop, if you look into the trace i posted the current node is returning the value as concatenated string. i.e, The result value of query is returning as concatenated string like "alphaBetaDelta"(in both the case - set as node-set or string).


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-02
11:55
ed00491298 wrote:
>
> Thank you for the reply,
>
> Even i tried with for each loop, if you look into the trace i posted the
> current node is returning the value as concatenated string. i.e, The
> result value of query is returning as concatenated string like
> "alphaBetaDelta"(in both the case - set as node-set or string).
Try:
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-text xml:space="preserve"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath
expression="$varRoleCatogeryKey//value[ancestor::*[@attr-name='nrfRoleCategoryKe
y']]"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
</arg-node-set>
</do-set-local-variable>
</arg-actions>
</do-for-each>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varMultipleRoleCatKeys"/>
</token-join>
</arg-string>
</do-set-local-variable>
>
> Thank you for the reply,
>
> Even i tried with for each loop, if you look into the trace i posted the
> current node is returning the value as concatenated string. i.e, The
> result value of query is returning as concatenated string like
> "alphaBetaDelta"(in both the case - set as node-set or string).
Try:
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-text xml:space="preserve"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath
expression="$varRoleCatogeryKey//value[ancestor::*[@attr-name='nrfRoleCategoryKe
y']]"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
</arg-node-set>
</do-set-local-variable>
</arg-actions>
</do-for-each>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varMultipleRoleCatKeys"/>
</token-join>
</arg-string>
</do-set-local-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
2017-06-05
15:18
On 6/2/2017 6:55 AM, Alex McHugh wrote:
> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
> <arg-node-set>
> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
> </arg-node-set>
> </do-set-local-variable>
Alex,
In this snippet, what does the XPATH accomplish?
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
> <arg-node-set>
> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
> </arg-node-set>
> </do-set-local-variable>
Alex,
In this snippet, what does the XPATH accomplish?
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-05
21:28
Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:
> On 6/2/2017 6:55 AM, Alex McHugh wrote:
>> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
>> <arg-node-set>
>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>> </arg-node-set>
>> </do-set-local-variable>
>
> Alex,
>
> In this snippet, what does the XPATH accomplish?
>
> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>
I prefer that to set local variable X = local variable X + newValue.
Calculating union makes more sense.
> On 6/2/2017 6:55 AM, Alex McHugh wrote:
>> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
>> <arg-node-set>
>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>> </arg-node-set>
>> </do-set-local-variable>
>
> Alex,
>
> In this snippet, what does the XPATH accomplish?
>
> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>
I prefer that to set local variable X = local variable X + newValue.
Calculating union makes more sense.
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
2017-06-06
01:05
On 6/5/2017 4:28 PM, Alex McHugh wrote:
> Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:
>> On 6/2/2017 6:55 AM, Alex McHugh wrote:
>>> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
>>> <arg-node-set>
>>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>>> </arg-node-set>
>>> </do-set-local-variable>
>>
>> Alex,
>>
>> In this snippet, what does the XPATH accomplish?
>>
>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>>
>
> I prefer that to set local variable X = local variable X + newValue.
> Calculating union makes more sense.
Cool, I never tried that. What happens if the values are duplicated?
Do you get a second instance in the resulting nodeste?
> Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:
>> On 6/2/2017 6:55 AM, Alex McHugh wrote:
>>> <do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
>>> <arg-node-set>
>>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>>> </arg-node-set>
>>> </do-set-local-variable>
>>
>> Alex,
>>
>> In this snippet, what does the XPATH accomplish?
>>
>> <token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
>>
>
> I prefer that to set local variable X = local variable X + newValue.
> Calculating union makes more sense.
Cool, I never tried that. What happens if the values are duplicated?
Do you get a second instance in the resulting nodeste?


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-06
05:27
Geoffrey Carman <geoffreycarmanNOSPAM@NOSPAMgmail.com> wrote:
>
> Cool, I never tried that. What happens if the values are duplicated?
> Do you get a second instance in the resulting nodeste?
>
>
Generally, yes you get a duplicate.
Follows the same logic as any other XPath union in that regard.
Can use ecmascript to make unique values.
>
> Cool, I never tried that. What happens if the values are duplicated?
> Do you get a second instance in the resulting nodeste?
>
>
Generally, yes you get a duplicate.
Follows the same logic as any other XPath union in that regard.
Can use ecmascript to make unique values.
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.
Eswar Donda

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-07
11:48
Hi Alex,
Thank you so much for the Help, It worked :):)
Thank you so much for the Help, It worked :):)
klasen

Micro Focus Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-01
13:45
On 01.06.2017 13:34, ed00491298 wrote:
>
> Hello All,
>
> I am using Loop Back driver to send email notification to users when the
> roles assigned to them are about to expire. In the email I need to
> Publish Role CN, Expiry date and nrfRoleCategorykey (multi-valued
> attribute in the role). For each role I am fetching nrfRoleCategorykey
> value using query, as it is multi-valued attribute it is giving all the
> values as a single concatenated string without any delimiter example as
> below:
> nrfroleCategoryKey: AlphaBetaDelta��. etc.
> I want these values with some delimiter as (Alpha, Beta, Delta,...etc).
use the join action for that:
<do-set-local-variable name="list" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varRoleCatogeryKey"/>
</token-join>
</arg-string>
</do-set-local-variable>
--
Norbert
>
> Hello All,
>
> I am using Loop Back driver to send email notification to users when the
> roles assigned to them are about to expire. In the email I need to
> Publish Role CN, Expiry date and nrfRoleCategorykey (multi-valued
> attribute in the role). For each role I am fetching nrfRoleCategorykey
> value using query, as it is multi-valued attribute it is giving all the
> values as a single concatenated string without any delimiter example as
> below:
> nrfroleCategoryKey: AlphaBetaDelta��. etc.
> I want these values with some delimiter as (Alpha, Beta, Delta,...etc).
use the join action for that:
<do-set-local-variable name="list" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varRoleCatogeryKey"/>
</token-join>
</arg-string>
</do-set-local-variable>
--
Norbert
--
Norbert
Norbert
Eswar Donda

Ensign
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-07
11:52
Thank you all for your responses, Solution given by alex has worked and able to get the values as expected:)
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-text xml:space="preserve"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath
expression="$varRoleCatogeryKey//value[ancestor::*[@attr-name='nrfRoleCategoryKe
y']]"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
</arg-node-set>
</do-set-local-variable>
</arg-actions>
</do-for-each>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varMultipleRoleCatKeys"/>
</token-join>
</arg-string>
</do-set-local-variable>
Br,
Eswar.
<do-set-local-variable name="varRoleCatogeryKey" scope="policy">
<arg-node-set>
<token-query class-name="nrfRole" datastore="src">
<arg-dn>
<token-global-variable name="RolesContainer"/>
</arg-dn>
<arg-match-attr name="CN">
<arg-value type="string">
<token-local-variable name="RoleName"/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">nrfRoleCategoryKey</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-text xml:space="preserve"/>
</arg-node-set>
</do-set-local-variable>
<do-for-each>
<arg-node-set>
<token-xpath
expression="$varRoleCatogeryKey//value[ancestor::*[@attr-name='nrfRoleCategoryKe
y']]"/>
</arg-node-set>
<arg-actions>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-node-set>
<token-xpath expression="$varMultipleRoleCatKeys | $current-node"/>
</arg-node-set>
</do-set-local-variable>
</arg-actions>
</do-for-each>
<do-set-local-variable name="varMultipleRoleCatKeys" scope="policy">
<arg-string>
<token-join delimiter=",">
<token-local-variable name="varMultipleRoleCatKeys"/>
</token-join>
</arg-string>
</do-set-local-variable>
Br,
Eswar.


Knowledge Partner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-06-08
01:22
Thank you for your confirmation, Eswar.
Alex
Alex