CLI Reference > Workflows and Documents Commands > im createquery
  
im createquery
creates a new Windchill RV&S query
Synopsis
im createquery [--copyColumnsFromQuery[=[user:]query] [--fields=field,field,...] [--[no]sortAscending][--sortField= field] [--image=[none|default|path][--description=value] [--shareWith=u=user1[:modify],user2[:modify],...;g=group1[:modify],group2[:modify],...] [--name=value] [--hostname=value] [--queryDefinitionFile=value] [--queryDefinition=query] [--sharedAdmin] [--port=value] [--password=value] [--user=value] [(-?|--usage)] [(-g|--gui)] [(-F value|--selectionFile=value)] [--quiet] [--settingsUI=[gui|default]] [--status=[none|gui|default]] [(-N|--no)] [(-Y|--yes)] [--[no]batch] [--cwd=value] [--forceConfirm=[yes|no]]
Description
You can define and store any number of queries using Windchill RV&S. A query is a request to select and list the issues that meet specific selection criteria. A selection criterion is a logical expression of specific values, or ranges of values, of the fields of the issue. For more information about queries and creating query constraints, refer to the Windchill RV&S Help Center.
For example, the following creates a new query that displays all Docs type issues that are part of the Release 2.0 project:
im createquery --name="Release 2.0 Docs Isssues" --queryDefinition='((field[Type]="Docs")and(field[Project]="Release 2.0"))'
Note the following:
When creating a query that includes a project name in a query constraint, the project name must include the forward slash (/).
You cannot query on configuration management project fields.
Displayed date fields do not change based on the time zone that a user is operating in; however, displayed date/time fields and time entries vary based on the time zone that a user is operating in.
Symbolic dates are evaluated on the Windchill RV&S Client’s time zone.
When specifying a date range in a query, all dates are treated as timestamps, converted to the time zone on the Windchill RV&S Server, and then truncated to a date-only format. The resulting date-only format is then converted to a Structured Query Language (SQL) statement format on the Windchill RV&S Server, and the query is run based on the time zone of the server. If the user defining the date range is not in the same time zone as the Windchill RV&S Server, a day can be lost or gained at either end of the defined range. The rollback of dates can cause the query results to vary.
* 
The date range conversion does not cause any problems when the user is in the same time zone as the Windchill RV&S Server. For example, if the Windchill RV&S Server is in the America/New_York time zone and the following query date range is defined by a user in Germany: Jan 1, 2007 to Jan 31, 2007. The final conversion of the date range is: Dec 31, 2005 06:00:00 AM GMT+01:00 to Jan 31, 2007 06:00:00 AM GMT+01:00. To avoid any date rollbacks when working with query date ranges in Windchill RV&S, PTC recommends that users specify the time zone that is used by the Windchill RV&S Server to which they are connecting.
Because dynamically computed fields are not stored in the database, dynamically computed short text fields cannot be located with an all text field search in the Windchill RV&S Client. To search for dynamically computed short text fields, create a query that includes a specific “field contains” comparison. For more information about computed fields, see your administrator.
Options
This command takes the universal options available to all im commands, as well as some general options. See theoptionsreference page for descriptions.
--copyColumnsFromQuery[=[user:]query]
specifies an existing query to copy the column configuration from to use as the default for the new query. If you do not specify a query to copy from, the new query uses the server default column configuration which consists of ID, Type, Summary, State, Assigned User, and Project columns, sorted by ID in ascending order.
* 
--fields=field, field,..., --[no]sortAscending, and --sortField=field are not mandatory, but if specified, they overwrite the current default column configuration.
--fields=
field,field,...
specifies the fields to use as the default columns for the query. This overrides the current default columns.
--[no]sortAscending
specifies the sort direction that issues are displayed in. This overrides the current default sort direction.
--sortField=field
specifies the field that issues are sorted by. This overrides the current default sort field.
--image=[none|default|<path>]
specifies whether an image appears for the new query.
--image=none
does not specify an image for the query.
--image=default
specifies the default funnel image for the query.
--image<=path> specifies the path and name of a custom image for the query, for example,.
c:\images\defect_icon.gif
* 
Images must be GIF or JPEG format, and no larger than 16 by 24 pixels.
--shareWith=u=user1[:modify],user2[:modify],...;g=group1[:modify],group2[:modify],...
specifies the users and groups that can use and modify the query. Your administrator defines users and groups.
--description=value
specifies a short description for the new query.
--name=value
specifies the name of the new query. Names may be a maximum of 100 characters and cannot contain square brackets.
--queryDefinition=query
specifies a string to define the query constraints. The query must be of the following format:
<rule> is defined as ( <filtergroup> )
<filtergroup> is defined as one of the following:
(<filtergroup> and <filtergroup> and ...) (<filtergroup> or <filtergroup> or ...)( (<filter>) and (<filter>) and ...)( (<filter>) or (<filter>) or ...)
where
<filter> is defined as disabled (<filter>)<filter> is defined as not (<filter>)<filter> is defined as <fields>|<subquery>|<attachment>|<relationship>|<branch>|<genericcp>|<histval>|<histdate>|<histuser>|<timeentry>|<testresult>|<item>
<histuser> is defined as histuser[Summary|State|..] was changed by <user>
<histuser> is defined as histuser.any field was changed by <user><histdate> is defined as histdate[Summary|State|..] was changed <datevalue> <histdate> is defined as histdate.any field was changed <datevalue><histval> is defined as histval[Summary|State|..]<value>
<genericcp> is defined as genericcp:<cptype>:<attrfieldidentifier>:[fieldname]
where <attrfieldidentifier> is attribute or entryattribute and [fieldname] is the real name, not the display name, of the attribute. Use the im viewcptype command to find the attribute name.
<genericcp> is defined as not (genericcp:si:attribute[resolutionlist]is empty)
<genericcp> is defined as genericcp:<cptype>.exists
<relationship> is defined as relationship[ID|Created User|..] using [Relationship Field]=<value>
<relationship> is defined as relationship.exists backward|forward using [Relationship Field]. To restrict your query to either backward or forward relationships, backward must be specified if you specify the Backward Relationships field, and the forward option must be specified if you specify the Forward Relationships field or a custom relationship field.
<relationship> is defined as relationshipFlag [Relationship Flag Name] backward|forward using [Relationship Field]
<attachment> is defined as attachment[file size|file name|mime type] <value><attachment> is defined as attachment.exists
<timeentry> is defined as timeentry[issue ID|user|entry date|source|duration|notes|created by|created date|modified by|modified date]
<timeentry> is defined as timeentry.exists
<testresult> is defined as testresult.isrelatedto <testresult> is defined as testresult.exists <testresult>is defined as testresult.hasattachment <testresult> is defined as testresult.hasrelateditem <testresult> is defined as [ID]comparison where ID can be one of Verdict, Verdict Type, Modified By, Modified Date, Session ID
<branch> is defined as branch.isBranch
<branch> is defined as branch.hasBranch
<branch> is defined as branch[X] in parent contains Y. This filter finds items where field X of the branched from item has a specific value. In other words, an item is a child (is a branch), and the parent item has field X with value Y. Examples follow:
<branch> is defined as branch[X] in child contains Y. This filter finds items where field X of the branched item has a specific value. In other words, an item is a parent (has a branch), and the child item has field X with value Y. Examples follow:
<item> is defined as item.node
<item> is defined as item.content
<item> is defined as item.segment
<item> is defined as item.subsegment
<item> is defined as item.lockeddocument
<item> is defined as item.meaningful
<item> is defined as item.nonmeaningful
<item> is defined as item.shareditem
<item> is defined as item.group
<item> is defined as item.teststep
<item> is defined as item.testcase
<item> is defined as item.testsession
<item> is defined as item.testsuite
<item> is defined as item.live
<item> is defined as item.versioned
* 
If document versioning is enabled, queries return all items (live and versioned) by default. To specify live or versioned items, include the item.live or item.versioned filter. For more information on document versioning, see the Windchill RV&S Help Center.
<subquery> is defined as subquery[Query1|Query2|...]
<fields> is defined as field[ID|Created User|Created Date|..] <value>
<fields> is defined as field.anyTextField
If document versioning is enabled, you can specify the following conditions to display live and versioned items by ID:
Note: You cannot display a range of versioned items, for example, "(field[ID]>123-1.0 and 128-1.0)".
For more information on live and versioned items, see the Windchill RV&S Help Center.
<value> is defined as <value> or "is empty"
<value> is defined as "is empty"
<value> is defined as <leftrangeop> numand <rightrangeop> num
<value> is defined as contains <text>
<value> is defined as <operator> numand <operator> num
<value> is defined as <operator> num
<value> is defined as hasSourceLinks
<rightrangeop> is defined as < | <=
<leftrangeop> is defined as | >=
<value> is defined as = <uservalue>, <uservalue>, ..
<uservalue> is defined as "me" | "unspecified" or "is empty" | user1 | user2|...
<value> is defined as <datevalue>
<datevalue> is defined as between mm/dd/yyyy and mm/dd/yyyy <datevalue> is defined as between mm/dd/yyyy hh/mm/ss and mm/dd/yyyy hh/mm/ss (Time is specified from 00:00:00 to 23:59:59 inclusive in 24 hour format; however, Windchill RV&S displays the time in 12 hour format. For example, specifying 13:56:45 displays the time as 1:56:45 PM.)<datevalue> is defined as in the last|next num days|months|years hours|minutes|seconds (Time is specified from 00:00:00 to 23:59:59 inclusive in 24 hour format; however, Windchill RV&S displays the time in 12 hour format. For example, specifying 13:56:45 displays the time as 1:56:45 PM.) <datevalue> is defined as today|yesterday|tomorrow
num is defined as .. | -1 | 0 | 1 | ..
<operator> is defined as = | > | >= | <= | < | <>
For example:
(((field[Summary]contains"Hello")or(field[Assigned Group]="everyone"))
and
(attachment.exists))
((field[Summary]contains"Requirement")or(field[Assigned Group]="Project Managers"))
((field[Category]="Technical Requirement") or (field[Category]="System Requirement")) or
(field[Modified Date] today)
* 
To reference the original query in the new query so that any changes to the original query are reflected in the new query, define <subquery> as subquery[OriginalQuery].
branch[ALM_Text] in parent contains "Project Description"
branch[ALM_Actual Budget] in parent = 12
branch[ALM_Actual Effort] in parent > 20
branch[Project] in child=/Projects/Release2
branch[Summary] in child contains "Some issue Summary"
branch[ALM_Content] in child 10
display a specific live item only. For example,"(field[ID]=123)" returns123.
display a live item and all versions of the item. For example,
"(field[ID]=123 include versions)"
returns
123,123-1.0,123-1.1, and123-1.2.
display a range of live items. For example, "(field[ID]>123 and 128)" returns 124, 125, 126, and 127.
display a specific versioned item. For example,"(field[ID]=123-1.0)" returns123-1.0.
--sharedAdmin
specifies the query as a system provided object (objects within the Windchill RV&S object model that support solution definition and management, as well as workflow migration). For more information, see your administrator.
Important:
Once a user object is converted to a system provided object, you cannot revert it to a user object again.
--queryDefinitionFile=value
specifies a file that contains the complete definition of the query. See --queryDefinition for the file format.
See Also
Commands: im copyquery, im deletequery, im editquery, im viewquery, im queries
Miscellaneous: options