Example

Build 1501 on 14/Nov/2017  This topic last edited on: 26/Feb/2014, at 11:10

The example below searches for users in a specified group, and returns results sorted by user name.

Search conditions which define the search and return the list of users sorted by ascending user name:

<SearchConditions

  xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  ObjectTypeName="user"

  SavedSearchName="">

  <SearchNode xsi:type="SearchConditionList">

    <List xsi:type="SearchCondition" Path="[user.groups.name]" Op="Equal">

      <From xsi:type="VariableSearchNode" Name="groupName" Type="String"/>

    </List>

  </SearchNode>

  <OrderList IsAscending="true">

    <Item xsi:type="AttributeRef" ObjectTypeName="user" AttributeTypeName="name"/>

  </OrderList>

</SearchConditions>

 

Executing this search configuration in the browser using the statement shown here, returns the results shown below. Notice that the results are returned in ascending order by user name:

http://localhost/tark4/do.ashx?cmd=search&name=usersInGroup&pars=groupName:planners

<?xml version="1.0" encoding="utf-8" ?>

<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://...>

  <searchResult n="3" from="0" count="3" queryTimeSpan="0">

    <xml>

      <objects xmlns="urn:schemas-teradp-com:gn4tera">

        <user nav:objectType="user" id="obj28301" name="Belinda" ...

         <user nav:objectType="user" id="obj35543" name="dario" ...

          <user nav:objectType="user" id="obj28308" name="Muriel" ...

      </xml>

  </searchResult>

</result>

 

Search conditions which define the search - returning the list of users sorted by descending user name:

<SearchConditions

  xmlns="http://www.teradp.com/schemas/GN4/1/SearchConditions.xsd"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  ObjectTypeName="user"

  SavedSearchName="">

  <SearchNode xsi:type="SearchConditionList">

    <List xsi:type="SearchCondition" Path="[user.groups.name]" Op="Equal">

      <From xsi:type="VariableSearchNode" Name="groupName" Type="String"/>

    </List>

  </SearchNode>

  <OrderList IsAscending="false">

    <Item xsi:type="AttributeRef" ObjectTypeName="user" AttributeTypeName="name"/>

  </OrderList>

</SearchConditions>

 

Executing this search configuration in the browser using the statement shown here, returns the results shown below. Notice that the results are returned in descending order by user name.

http://localhost/tark4/do.ashx?cmd=search&name=usersInGroup&pars=groupName:planners

 

<?xml version="1.0" encoding="utf-8" ?>

<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://...>

  <searchResult n="3" from="0" count="3" queryTimeSpan="0">

    <xml>

      <objects xmlns="urn:schemas-teradp-com:gn4tera">

        <user nav:objectType="user" id="obj28308" name="Muriel" ...

        <user nav:objectType="user" id="obj35543" name="dario" ...

        <user nav:objectType="user" id="obj28301" name="Belinda" ...

    </xml>

  </searchResult>

</result>