Named Queries are pre-defined queries with which users of Content Station and Smart Connection can 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 9), the Search box (Content Station 10) or the Smart Connection panel (Smart Connection for InDesign and InCopy). After selection, the query is automatically executed.
Optionally, fields for further filtering the search results can also be made available.
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 9 (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.
- The list in the Search box of Content Station 10
- Comment. Optional administrator comment about the query, for internal reference only.
- Interface. List of query parameters to appear as filter options in the interface for further narrowing down the search results. Each parameter must start on a new line, respecting the following syntax:
name as it appears in the interface,object type,default value,list value 1/list value 2/...
Example: Here, two fields are added: one field of type 'string' in which a user can type custom text, and another of type 'integer' with a default value of 72: name,string,, dpi,int,72, This will appear as follows in the interface (shown is Content Station 10): |
- Name. (Mandatory.) An object of type 'string', used as the label for the field in the interface.
- Object type. (Mandatory.) Must be one of the following:
- string
- bool
- int
- list
- Default value. (Optional.) Initial value of the parameter.
- List values (Optional.) Can be used when the object type is 'list'. Holds the values of the list. Each entry must be separated by a forward slash ( / ). When no default is set, the first entry is pre-selected.
Example: Here, a list named 'list of items' contains 3 items of which item 2 is the default: list of items,list,item 2,item 1/item 2/item 3 |
- 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:
|
- 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.
Here, a Named Query is created that lets uses find files that have a certain DPI value set. The default search is for a DPI value of 72. Users can fine-tune the results by searching for a file name or a different DPI value.
Figure: A Named Query for locating files with a specific DPI value (default is 72).
It looks as follows in Content Station 10:
The following code is used:
Interface:
name,string,,
dpi,int,72,
Query:
/*SELECT*/ select o.`id` as `ID`, o.`type` as `Type`, o.`name` as `Name`, 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`, o.Dpi
/*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.name like '%$name%') and (o.dpi = $dpi)
Creating a Named Query
Step 1. Access the Overview of Named Queries page.
Choose Named Queries in the Maintenance menu on the left side of the screen or on the Home page.
Step 2. Click New Query.
The Named Queries page appears.
Step 3. Fill out all details.
Note: Take note of the following:
|
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:
|
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')
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.