WoodWing Help Center

Using Named Queries in Enterprise Server 9

Using Named Queries in Enterprise Server 9

Named Queries are pre-defined queries that allow users of Content Station and Smart Connection to quickly perform a search in Enterprise in order to locate particular files.

Users of Content Station and Smart Connection do this by choosing the Named Query in the Search Application (Content Station) or Smart Connection panel (Smart Connection).

Figure: The default Named Query named 'Templates' that is defined in Enterprise Server (A), appears as an option in the Search Application in Content Station (B).

Named Queries can be seen as static search templates that are made available by the system administrator to all users and which cannot be changed by the end user.

Components

A Named Query consists of the following components:

  • Query name. Name of the query as it should appear in the client applications:
  • The Search menu of the Smart Connection panel in InDesign or InCopy.
  • The Search menu of the Search pane in Content Station.
  • Comment. Optional administrator comment about the query, for reference purposes only.
  • Interface. List of query parameters. Each parameter must start on a new line, respecting the following syntax:

<name>,<type> [,<default>] [,<list entries>]

  • name. (Mandatory.) Name of the parameter. Displayed as pop-up help for the input field in the Smart Connection panel.
  • type. (Mandatory.) Data type of parameter. Must be one of the following: string | bool | int | list
  • default. (Optional.) Initial value of the parameter. Automatically filled-in the first time when the user selects this Named Query.
  • list entries (Optional.) Only used when type is 'list'. Entries listed in combo box to allow user to make a selection. Each entry must be separated using slashes ( / ). When no default is set, the first entry is pre-selected.
  • Query SQL. The SQL statement for this Named Query. The parameters can be used inside the SQL with <$parametername>. For string values, this needs to be surrounded by double quotes ("). The name of the user executing the query can be used in the SQL statement as "$user".

Note: The SQL statement must contain the following:

/*SELECT*/ 
/*FROM*/ 
/*JOINS*/ 
/*WHERE*/ 
comments
  • Check access. Defines if a check should be made whether or not the user has sufficient rights to access each returned file. If the user does not have sufficient rights, the file is not included in the search results.

Note: Enabling this option can have a negative impact on performance (longer waiting times for the user).

Example: Disable this option when it is known beforehand that all users are authorized the files, such as a query that locates all templates.

Creating a Named Query

Step 1. Access the Overview of Named Queries page.

The Overview of Named Queries page

Step 2. Click New Query.

The Named Queries page appears.

The Named Queries page

Step 3. Fill out all details.

Note: Take note of the following:

  • The first 4 columns returned should always be id, type, name and format (see examples below). These columns are the bare minimum for client applications to have a basic understanding of what kind of objects are listed. (For example, "Format" is used to display the correct file icon and to open the file in an appropriate editor.)
  • To support status colors and automatic updating of column fields, your query also needs to return brandid, issueid, sectionid, and stateid. Normally these are returned as the last columns.
  • Before adding new Named Queries to the system, we recommend to first make sure that the SQL is correct by executing it, for example by using phpMyAdmin.
  • Newly created Named Queries will only be available to a user when he/she logs out and logs back in to the system. However, changes in the SQL section of an existing Named Query do NOT require users to log out and in again.

Tip: To hide a Named Query client-side, start its name with a dot (for example .MyQuery).

Step 4. Click Update.

Code for the default queries

Below follows the full code for the default Named Queries 'Libraries' and 'Templates'.

Notes:

  • Since Enterprise 7, the Named Queries 'NameSearch' and 'Inbox' have been made obsolete.
  • The notations shown are those for MySQL.
  • The 'StateColor' option is included so that all client applications can display the correct Workflow Status color.
  • Using single quotes on Mac OS requires Enterprise Server 9.5 or higher.

Libraries

Full code for the Libraries query, used for locating all InDesign Library files:

/*SELECT*/ 
select o.`id` as `ID`, o.`type` as `Type`, o.`name` as `Name`, o.`format` as `Format`, st.`state` as `State`, ul.`fullname` as `LockedBy`, p.`publication` as `Publication`, s.`section` as `Section`, o.`comment` as `Comment`, o.`routeto` as `RouteTo`, un.`fullname` as `Creator`, o.`format` as `Format`, um.`fullname` as `Modifier`, p.`id` as `PublicationId`, s.`id` as `SectionId`, st.`id` as `StateId`, st.`color` as `StateColor`, l.`lockoffline` as `LockForOffline` 
/*FROM*/ 
from `smart_objects` o 
/*JOINS*/ 
left join `smart_publications` p on (o.`publication` = p.`id`) 
left join `smart_publsections` s on (o.`section` = s.`id`) 
left join `smart_states` st on (o.`state` = st.`id`) 
left join `smart_objectlocks` l on (o.`id` = l.`object`) 
left join `smart_users` ul on (l.`usr` = ul.`user`) 
left join `smart_users` um on (o.`modifier` = um.`user`) 
left join `smart_users` un on (o.`creator` = un.`user`) 
/*WHERE*/ 
where (o.`type` = 'Library')

Templates

Full code for the Templates query, used for locating all template files:

/*SELECT*/ 
select o.`id` as `ID`, o.`type` as `Type`, o.`name` as `Name`, o.`format` as `Format`, st.`state` as `State`, ul.`fullname` as `LockedBy`, p.`publication` as `Publication`, s.`section` as `Section`, o.`comment` as `Comment`, o.`routeto` as `RouteTo`, un.`fullname` as `Creator`, o.`format` as `Format`, um.`fullname` as `Modifier`, p.`id` as `PublicationId`, s.`id` as `SectionId`, st.`id` as `StateId`, st.`color` as `StateColor`, l.`lockoffline` as `LockForOffline` 
/*FROM*/ 
from `smart_objects` o 
/*JOINS*/ 
left join `smart_publications` p on (o.`publication` = p.`id`) 
left join `smart_publsections` s on (o.`section` = s.`id`) 
left join `smart_states` st on (o.`state` = st.`id`) 
left join `smart_objectlocks` l on (o.`id` = l.`object`) 
left join `smart_users` ul on (l.`usr` = ul.`user`) 
left join `smart_users` um on (o.`modifier` = um.`user`) 
left join `smart_users` un on (o.`creator` = un.`user`) 
/*WHERE*/ 
where (o.`type` = 'LayoutTemplate' or o.`type` = 'ArticleTemplate' or o.`type` = 'LayoutModuleTemplate') 
Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.