Configuring script-based searches

Build 1501 on 14/Nov/2017  This topic last edited on: 1/Mar/2013, at 15:58

ShowExtendedConditions allows all the parameters to be provided from an AddIn command.

An example of usage would be to allow the contents of a folder related to the selection to be displayed. Right clicking on an item in a collection contents listing displays the content menu:

showextcond1

Clicking on the Show Folder Contents navigates the listing to the contents of the folder containing the collection item:

showextcond2

The following AddIn Command is called to perform this operation:

 <ShellCommand(CanExecute:="HasSelectedObject")>

  Public Sub ShowFolderContents()

    Dim selectedObjects As IGenericAttrObjList = Main.GetSelectedObjects()

 

    If selectedObjects IsNot Nothing Then

      Dim folderIds As List(Of Integer) = 

         selectedObjects.GetReferenceValues("folder")

 

      If folderIds IsNot Nothing Then

        Dim pars As New NameValueCollection()

        pars("folderIds") = GNClient.StringUtility.ListToString(folderIds, ",")

        ShowExtendedConditions("AllContentShell", "FolderContents", pars, "Folder")

      End If

    End If

  End Sub

 

The above generates a list of folderIds by calling IGenericAttriObjList.GetReferenceValues to get all the folders referenced directly in the current selection. The folderIds are then passed to the FolderContents ExtendedConditions defined in the AllContentShell BaseQuery via a NameValueCollection object:

  <BaseQuery Name="AllContentShell" ObjectTypeName="folderObject">

    <DirectoryStyleList>...</DirectoryStyleList>

    <SearchList>...</SearchList>

    <ExtendedConditions Name="FolderContents">

      <SearchNode xsi:type="SearchConditionList"

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

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

        <List xsi:type="SearchCondition" 

           Path="[folderObject.folderRef]" Description="Folder" Op="In">

          <Ids xsi:type="VariableSearchNode" Name="folderIds" Type="IdList" Optional="false" />

        </List>

      </SearchNode>

    </ExtendedConditions>

  </BaseQuery>

 

The same ExtendedConditions can be used directly from a click in a directory style. For example, clicking on the folder link:

showextcond3

will navigate to the contents of /Wires/AP Images. The directory style markup for this is:

<BaseQuery Name="CollectionShell" 

  ObjectTypeName="archiveObject" ContextMenuName="CollectionPopup">

  <DirectoryStyleList>

    <DirectoryStyle Name="List" Height="1" Width="-1" >

      <ColStyle Name="Folder">

        <CellTemplate >

          <l:HyperlinkButton VerticalAlignment="Top" Margin="4,0,0,0"

            Command="{x:Static l:Commands.ClickScript}"

            CommandParameter="ShowFolderContentsClick"

            ObjectId="{Binding Path=[archiveObject.folderRef]}"

            Content="{Binding Path=[archiveObject.folderRef.path]}"

            ToolTip="Click to show folder contents"/>

        </CellTemplate>

      </ColStyle>

 

Clicking on the folder link calls the ShowFolderContentsClick AddIn command:

<ShellCommand()>

Public Sub ShowFolderContentsClick(clickSource As IClickScriptSource)

  If clickSource.ObjectId <> DBDesc.InvalidId Then

    Dim pars As New NameValueCollection()

    pars("folderIds") = clickSource.ObjectId.ToString()

    ShowExtendedConditions("AllContentShell", "FolderContents", pars, "Folder")

  End If

End Sub

 

The default action for the click is to navigate to a new set of results in the current tab; holding down the control key will create a new tab group for the results, whereas holding down the shift key will create a tab within the current tab group.

See also

Configuring context searches with ExtendedConditions