Previous Topic: set view Command—Define a View

Next Topic: set wait-for-multiwrite Command

Views Parameters

You use a views parameter inside the set view command to specify a placeholder for a string. The DSA will determine the value of the views parameter when the view is invoked or after the DSA has run an earlier phase within the view.

The syntax of a views parameter is as follows:

[$][phaseNumberList:]attributeName[substringIdentifier]
$

(Optional) Specifies that the DSA should treat this as a views parameter.

If the $ is missing, then the string is treated as a literal attribute name and no substitution occurs. In that case, substringIdentifier must be blank.

phaseNumberList:

(Optional) Defines the phase number that produces the value of attributeName. If phaseNumber: is omitted, then the DSA provides the value of attributeName from the filter given in the LDAP search command that invoked the view.

phaseNumber must be a smaller number than the number of the phase in which the parameter is used. That is, a phase can refer only to earlier phases of the view.

You can specify a list of phase numbers when using conditional views.

attributeName

Specifies the attribute whose value is used to replace the parameter.

substringIdentifier

(Optional) Specifies a section within an attribute value string.

There are two possible formats for the substring identifier.

The first form for substringIdentifier is useful if you want to extract a substring based on delimiter characters, and is as follows:

[delimiterString:substringNumber]

The square brackets and the colon are part of the syntax, and are required if this option is used.

delimiterString

Defines the delimiter inside the attribute value string. It is a literal string so, for example, it can include white space, quotation marks, and non-alpha-numeric characters. The delimiter string partitions the attribute value into substrings.

substringNumber

Specifies which substring to extract from the attribute value string. The substrings of the attribute value are numbered from left to right starting at one.

The second form for substringIdentifier is useful if you want to extract the leading DNs from a string of DNs, or if you want to extract the leading characters of the string. This form is as follows:

[numberOfDNsOrCharacters]

The square brackets are part of the syntax and are required if this option is used.

numberOfDNsOrCharacters

Specifies how many RDNs or characters to extract from the attribute value string, starting at the leftmost character.

If this parameter is used as part of the subtree specification of a phase ("subtree=..."), then it returns the number of RDNs; otherwise it specifies the number of characters.

Example: View Parameter $cn

When the view is invoked, the DSA replaces the example string with the value of the cn attribute provided in the filter of the search command that was used to invoke the view.

In this example, the search is invoked with the following command:

ldapsearch... (cn="Smith, John")

The $cn is replaced with the following value:

Smith, John

Example: View Parameter $cn[,:1]

When the view is invoked, the DSA replaces the example string with the characters preceding the first comma in the value of the cn attribute.

In this example, the search is invoked with the following command:

ldapsearch... (cn="Smith,John")

The $cn[,:1] is replaced with the following value:

Smith

Example: $cn[7]

When the view is invoked, the DSA replaces the example string with the first seven characters in the value of the cn attribute.

In this example, the search is invoked with the following command:

ldapsearch... (cn="Smith,John")

The $cn[7] is replaced with the following value:

Smith,J

Example: $3:cn

Immediately after running phase three of the view, the DSA replaces the example string with the value of the cn attribute returned by phase three. The example string is only valid in phases four and later.

Example: $2,3:cn

Using $2,3:cn in the following example uses $2:cn or $3:cn depending on which phase was invoked.

if ( condition )
{ (phase = 2) }
else
{ (phase = 3) }

Example: subtree= $1:dn

...
(phase=2
subtree = $1:dn
...

This is a fragment of a set view command. Immediately after running phase one, the DSA replaces the string $1:dn with the value of the DN of each search result returned in phase one. If phase one returns multiple DNs, then phase two is run multiple times—once for each DN result returned from phase one.

Example: subtree= $1:dn[3]

...
(phase=2
subtree = $1:dn[3]
...

This is a fragment of a set view command. Immediately after running phase one, the DSA replaces the string $1:dn[3] with the value of the first three RDNs of the DNs of each search result returned in phase one. If phase one returns multiple DNs, then phase two is run multiple times—once for each DN result returned from phase one.

Example: subtree="uid=$1:uids,o=Democorp,c=AU"

...
(phase=2
subtree="uid=$1:uids,o=Democorp,c=AU"
...

This is a fragment of a set view command. Immediately after running phase one, the DSA replaces the string $1:uid with the value of 'uids returned by the phase one search. If phase one returns multiple DNs, then phase two is run multiple times: once for each DN result returned from phase one.

For example, if phase returns 12345 for the value of uid, then this fragment is exactly equivalent to the following:

...
(phase=2
subtree="uid=12345,o=Democorp,c=AU"
...