Knowledge Partner
Knowledge Partner
249 views

Building Query tokens Read attr list dynamically?

How could I build a Query token that gets the Read-attr list from a GCV
or the like?

I want to query for a list of attrs, but I do not want to explicitly
list them in code, since I know the list will change 'often' and I would
prefer to change a GCV instead of code...

I guess I could just query for the read-attr * which will return all
attributes... That actually would work for this use case, in
hindsight, but I would still like to consider how I might do this?

I suppose I could try and catch the query event at the OTP, and add XML
elements and nodes to it as needed. But that is not scalable in a
fashion that would make this easier.

I can do variable expansion for the variable name... Hmm, could I make
a nodeset variable, with the XML of
<read-attr attr-name="attr1">
<read-attr attr-name="attr2">
<read-attr attr-name="attr3">
<read-attr attr-name="attr4">

And then variable expand THAT in the attr name field? Nah that won't
work either. Hmm...

Any ideas?
Labels (1)
0 Likes
3 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Building Query tokens Read attr list dynamically?

I would create a GCV (type list), do a for-each and add all attributes using append-xlm-element and set-xml-attribute.
If you only want to use this for a specific set of queries you can use a dummy attribute name in read-attr that will trigger the
policy.

Best regards,
Tobias

On 2011-11-29 01:11, Geoffrey Carman wrote:
> How could I build a Query token that gets the Read-attr list from a GCV or the like?
>
> I want to query for a list of attrs, but I do not want to explicitly list them in code, since I know the list will change
> 'often' and I would prefer to change a GCV instead of code...
>
> I guess I could just query for the read-attr * which will return all attributes... That actually would work for this use case,
> in hindsight, but I would still like to consider how I might do this?
>
> I suppose I could try and catch the query event at the OTP, and add XML elements and nodes to it as needed. But that is not
> scalable in a fashion that would make this easier.
>
> I can do variable expansion for the variable name... Hmm, could I make a nodeset variable, with the XML of
> <read-attr attr-name="attr1">
> <read-attr attr-name="attr2">
> <read-attr attr-name="attr3">
> <read-attr attr-name="attr4">
>
> And then variable expand THAT in the attr name field? Nah that won't work either. Hmm...
>
> Any ideas?


0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Building Query tokens Read attr list dynamically?

Geoffrey Carman wrote:

> I want to query for a list of attrs, but I do not want to explicitly list
> them in code, since I know the list will change 'often' and I would prefer to
> change a GCV instead of code...


put them in a GCV in CSV format and use <token-xpath
expression='query:search($destQueryProcessor, "~SearchScope~", "",
"~SearchBase~", "~Class~", "~FilterAttr~", "~FilterValue~", "~ReadAttrList~") ?
0 Likes
Knowledge Partner
Knowledge Partner

Re: Building Query tokens Read attr list dynamically?

On 12/4/2011 6:58 AM, Lothar Haeger wrote:
> Geoffrey Carman wrote:
>
>> I want to query for a list of attrs, but I do not want to explicitly list
>> them in code, since I know the list will change 'often' and I would prefer to
>> change a GCV instead of code...

>
> put them in a GCV in CSV format and use<token-xpath
> expression='query:search($destQueryProcessor, "~SearchScope~", "",
> "~SearchBase~", "~Class~", "~FilterAttr~", "~FilterValue~", "~ReadAttrList~") ?


Good one. That is probably the easiest way to do it. I did not think
of that one.

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.