Search controls

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:52

Search controls belong to the http://www.teradp.com/schemas/GN4/1/StandardSearchControls.xsd namespace, for which we commonly use the prefix “ssc”. Search controls can be of two different type: container or visible.

Containers

Containers are used to combine other search controls between them. Currently, the only container search control is ssc:and.

ssc:and

The ssc:and search control is a container, that allow combining two or more search controls.

Example

 <ssc:and>

   <ssc:textBox path="@number" operators="Equal" />

   <ssc:calendar path="gn4:editionRef/nav:refObject/gn4:edition/@date" label="date" />

   <ssc:dropDownObjects

     path="gn4:workstateRef/@idref"

     xquery="gn4:workstate[gn4:levels/gn4:in='Page']"

     operators="Equal NotEqual" />

   <ssc:dropDownObjects path="gn4:sectionRef/@idref" xquery="gn4:section" />

   <ssc:dropDownObjects path="gn4:zoneRef/@idref" xquery="gn4:zone" />

 </ssc:and>

Properties

Children

List of the search controls to be combined together.

Visibles

Visible search controls are the controls the user can interact with, like a text box, a dropdown, a tree, etc…

Common properties to all “visible” controls

path

Mandatory. Path serving to generate the search condition generated by the control.

label

Optional. Label of the control.

If not set, we consider a default value extracted from the value of the path property: if it starts with “@” or “gn4:”, we remove the prefix and consider the rest of the string; otherwise we consider the whole value of the path property. So that gn4:workstateRef/@idref becomes workstateRef, @number becomes number.

If explicitly set to an empty string, then no label is displayed.

operators

Optional. Space separated list of the operators to be displayed in the dropdown.

If this property is not set, then a default applies. If it contains only one operator, then this operator applies and the dropdown list does not show.

The default value as well as the operators available depends on the type of the search control (see the documentation of the specific search controls).

ssc:autoComplete

NOT IMPLEMENTED YET

ssc:calendar

The ssc:calender search control is rendered in different ways depending on the operator to be used:

-As a calendar picker if the operator is one of On, Before and After

-As two calendar pickers if the operator is Between

-As a text box if the operator is in the form LastXXX or NextXXX

-No control at all (except the dropdown for the operator) if the operator is one of Today, Yesterday, Tomorrow, ThisWeek, ThisMonth, and this year

It serves to search date and date time attributes.

Example

The following example allows filtering page objects depending on the date of the edition they belong to:

<ssc:calendar

path="gn4:editionRef/nav:refObject/gn4:edition/@date"

label="date"

 operators="Today Yesterday Tomorrow On Between" />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to On.The operators available for that control are On, Before, After, Between, Today, Yesterday, Tomorrow, ThisWeek, ThisMonth, ThisYear, LastMinutes, LastHours, LastDays, LastWeeks, LastMonths, LastYears, NextMinutes, NextHours, NextDays, NextWeeks, NextMonths and NextYears.

ssc:calendarTime

See ssc:calendar.

ssc:checkBoxes

The ssc:checkBoxes search control is used for searching enum attributes, or filtering search result by object type. It is rendered as a list of check boxes featuring one check box for each value specified by the values property.

Example

The following example allows generating a list of check boxes that can be used to filter result list by object type, in order to get only audio, image, story or video objects.

<ssc:checkBoxes path="@nav:objectType" valuesStringScope="ObjTypeCaption" label="type">

 <ssc:value>audio</ssc:value>

 <ssc:value>image</ssc:value>

 <ssc:value>story</ssc:value>

 <ssc:value>video</ssc:value>

</ssc:checkBoxes>

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to In. The operators available for that control are In and NotIn.

values

Mandatory. Indicates the possible values to select from.

valuesStringScope

Optional. StringScope to be used to translate the values of the control. If not set, it defaults to EnumCaption.

orientation

Indicates whether the checkboxes must be aligned horizontally or vertically.

ssc:checkBoxesObjects

The ssc:checkBoxesObjects search control is used for searching reference, multi-reference, single category and multi category attributes. It is rendered as a list of check boxes associated to GN4 objects.

Example

The following example allows creating a set of check boxes corresponding to the workstate objects for which the levels enum set attribute feature the ‘Page’ enum set entry.

<ssc:checkBoxesObjects

path="gn4:workstateRef/@idref"

xquery="gn4:workstate[gn4:levels/gn4:in='Page']"

operators="In NotIn" />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to In. The operators available for that control are In and NotIn.

xquery

Mandatory. XQuery used to retrieve all the objects that can be selected with this control.

valueXPath

Optional. XPath used to determine the value of each entry of the control. If not set, it defaults to @id.

labelXPath

Optional. XPath used to determine how to display the entries of the control. If not set, it defaults to @nav:descName.

orientation

Indicates whether the checkboxes must be aligned horizontally or vertically.

ssc:dropDown

The ssc:dropDown search control is used for searching enum attributes, or filtering search result by object type. It is rendered as a drop down list filled with the value specified by the values property.

Example

The following example allows generating a drop down list that can be used to filter result list by object type, in order to get only audio, image, story or video objects.

<ssc:dropDown path="@nav:objectType" valuesStringScope="ObjTypeCaption" label="type">

 <ssc:value>audio</ssc:value>

 <ssc:value>image</ssc:value>

 <ssc:value>story</ssc:value>

 <ssc:value>video</ssc:value>

</ssc:dropDown>

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to Equal. The operators available for that control are Equal and NotEqual.

values

Mandatory. Indicates the possible values to select from.

valuesStringScope

Optional. StringScope to be used to translate the values of the control. If not set, it defaults to EnumCaption.

ssc:dropDownObjects

The ssc:dropDownObjects search control is used for searching reference, multi-reference, single category and multi category attributes. It is rendered as a drop down list filled with GN4 objects.

Example

The following example allows populating a drop down list with the workstate objects for which the levels enum set attribute feature the ‘Page’ enum set entry.

<ssc:dropDownObjects

path="gn4:workstateRef/@idref"

xquery="gn4:workstate[gn4:levels/gn4:in='Page']"

operators="Equal NotEqual" />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to Equal. The operators available for that control are Equal and NotEqual.

xquery

Mandatory. XQuery used to retrieve all the objects that can be selected with this control.

valueXPath

Optional. XPath used to determine the value of each entry of the control. If not set, it defaults to @id.

labelXPath

Optional. XPath used to determine how to display the entries of the control. If not set, it defaults to @nav:descName.

ssc:radios

The ssc:radios search control is used for searching enum attributes, or filtering search result by object type. It is rendered as a list of radio buttons featuring one radio for each value specified by the values property.

Example

The following example allows generating a list of radio buttons that can be used to filter result list by object type, in order to get only audio, image, story or video objects.

<ssc:radios path="@nav:objectType" valuesStringScope="ObjTypeCaption" label="type">

 <ssc:value>audio</ssc:value>

 <ssc:value>image</ssc:value>

 <ssc:value>story</ssc:value>

 <ssc:value>video</ssc:value>

</ssc:radios>

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to Equal. The operators available for that control are Equal and NotEqual.

values

Mandatory. Indicates the possible values to select from.

valuesStringScope

Optional. StringScope to be used to translate the values of the control. If not set, it defaults to EnumCaption.

orientation

Indicates whether the radio buttons must be aligned horizontally or vertically.

ssc:textBox

The ssc:textBox search control is rendered as a text box. It is used for searching string attributes. In order to search numeric attributes with a text box, use ssc:textBoxNumeric instead.

Example

<ssc:textBox path="gn4:title" operators="Equal Contains StartsWith EndsWith" />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to Contains. The operators available for that control are Equal, Contains, StartsWith and EndsWith.

ssc:textBoxNumeric

The ssc:textBoxNumeric search control is rendered as one or two text box (depending on the operator to be used). It is used for searching numeric attributes. In order to search string attributes with a text box, use ssc:textBox instead.

Example

<ssc:textBoxNumeric path="@number" operators="Equal " />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to Equal. The operators available for that control are Between, Equal, GreaterThan, GreaterThanOrEqual, LowerThan, LowerThanOrEqual, NotEqual.

ssc:treeObjects

The ssc:treeObjects search control is rendered with a tree selection. It is used for searching reference attributes, like folders.

Example

<ssc:treeObjects path="gn4:folderRef/@idref" operators="In InSubtree NotIn NotInSubtree" attributeFullName="folderObject.folderRef" selectionMode="Multiple" refAttributes="folderParent" refObjectType="folder" />

Properties        

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to In. The operators available for that control are In, InSubTree, NotIn, NotInSubtree.

attributeFullName

Optional. See “Common properties to all “visible” controls”.

refAttributes

Attributes referencing the parent object in the tree - e.g. folder.folderParent in the case of the folder tree.

refObjectType

Object type to list in tree.

selectionMode

One of ‘Single’, ‘Multiple’ or ‘Extended’.

showHomeFoldersOnTop

Shows the home folder on top.

homeFolderOnly

Shows the home folder only.

root

Root path to display the tree from.

 

ssc:time

The ssc:time search control is rendered with a time search. It is used for searching date attributes.

Example

<ssc:time path="gn4:editionRef/nav:refObject/gn4:edition/@date" operators="On After Before" />

Properties

path

Mandatory. See “Common properties to all “visible” controls”.

label

Optional. See “Common properties to all “visible” controls”.

operators

Optional.  See “Common properties to all “visible” controls”. If not set, it defaults to On. The operators available for that control are On, After, Before.

Search Filters

It is possible to use a filtering mechanism within the search form that enables the contents of one search control to be filtered by the contents of another. Only dropDownObjects uses this mechanism where it can be used to display a hierarchical set of values such as in this examples case title <- edition.

Example

<ssc:dropDownObjects 

  path="gn4:editionRef/nav:refObject/gn4:edition/gn4:titleRef/@idref" 

  sourceName="titleRef"

  label="Title" xquery="gn4:title order by @name"/>

 

<ssc:dropDownObjects path="gn4:editionRef/@idref" 

  label="Edition" xquery="gn4:edition order by @descName">

  <ssc:filter xquery="fn:in( gn4:titleRef/@idref, @@)" 

    isOptional="false" sourceName="titleRef"/>

</ssc:dropDownObjects>

 

<ssc:dropDownObjects path="gn4:sectionRef/@idref" 

  sourceName="sectionRef"

  labelXPath="@name" xquery="gn4:section order by @name">

 

<ssc:filter xquery="fn:in( gn4:titleRef/@idref, @@)" 

  isOptional="false" sourceName="titleRef"/>

</ssc:dropDownObjects>

 

In the above, the ssc:filter element filters the contents of the containing ssc:dropDownObjects by combining values of another control identified by the sourceName value with the filter’s xquery value. The filter’s sourceName value must match a dropDownObjects’ sourceName value.

In this case, the title values is identified by sourceName=“titleRef” both on the dropDownObjects element and the referencing filter.

Note that the section is also filtered by the title.

Properties

xquery

The query is combined with that of the containing element’s xquery to create the complete expression that is used to determine the elements to display. The characters @@ are used within the xquery value to indicate where the values identified by sourceName are to be substituted.

isOptional

If this value is true then no selection is required in the control identified by sourceName. When no selection is made in the source control, the displayed elements will be those generated by the xquery of the dropDownObjects element. When a selection is made, the same xquery will be combined with that of the filter’s to generated the displayed elements.

If this value is false then when no value is selected in the source control then the filtered control will not display any elements.

sourceName

Identifies the source of the values that are used to filter related control. The source control must also have a matching sourceName value. The sourceName value must be unique amongst the source controls.

Summary

The following table is a summary of all the search controls available, their properties and the operators they support.

 

textBoxNumeric

textBox

radios

dropDownObjects

dropdown

checkBoxesObjects

checkBoxes

calendar

and

Controls


path, label, operators

path, label, operators

path, label, values, valuesStringScope, operators

path, label, xquery, valueXPath, labelXPath, operators

path, label, values, valuesStringScope, operators

path, label, xquery, valueXPath, labelXPath, orientation, operators

path, label, values, valuesStringScope, orientation, operators

path, label, operators

children

Properties

 

 

 

 

 

 

 

X

 

After

Operators available (in red, the default one)

 

 

 

 

 

 

 

 

 

At

 

 

 

 

 

 

 

X

 

Before

X

 

 

 

 

 

 

X

 

Between

 

X

 

 

 

 

 

 

 

Contains

X

X

X

X

X

 

 

 

 

Equal

 

X

 

 

 

 

 

 

 

EndsWith

X

 

 

 

 

 

 

 

 

GreaterThan

X

 

 

 

 

 

 

 

 

GreaterThanOrEqual

 

 

 

 

 

 

 

X

 

LastDays

 

 

 

 

 

 

 

X

 

LastHours

 

 

 

 

 

 

 

X

 

LastMinutes

 

 

 

 

 

 

 

X

 

LastMonths

 

 

 

 

 

 

 

X

 

LastWeeks

 

 

 

 

 

 

 

X

 

LastYears

X

 

 

 

 

 

 

 

 

LowerThan

X

 

 

 

 

 

 

 

 

LowerThanOrEqual

 

 

 

 

 

X

X

 

 

In

 

 

 

 

 

 

 

X

 

NextDays

 

 

 

 

 

 

 

X

 

NextHours

 

 

 

 

 

 

 

X

 

NextMinutes

 

 

 

 

 

 

 

X

 

NextMonths

 

 

 

 

 

 

 

X

 

NextWeeks

 

 

 

 

 

 

 

X

 

NextYears

X

 

X

X

X

 

 

 

 

NotEqual

 

 

 

 

 

X

X

 

 

NotIn

 

 

 

 

 

 

 

X

 

On

 

X

 

 

 

 

 

 

 

StartsWith

 

 

 

 

 

 

 

X

 

ThisMonth

 

 

 

 

 

 

 

X

 

ThisWeek

 

 

 

 

 

 

 

X

 

ThisYear

 

 

 

 

 

 

 

X

 

Today

 

 

 

 

 

 

 

X

 

Tomorrow

 

 

 

 

 

 

 

X

 

Yesterday