Query language
This training page discusses running queries from the Query Builder, running queries directly on IPLM CLI, and creating a Saved query for later use.
Query language
The Perforce IPLM query language provides powerful search capabilities for IPs and other objects. This can be used to filter the results of list commands, eg: find IPs with properties that exceed a certain value, find IPs created after particular time-stamp, find IPs of certain type etc. Multiple queries can be built in a single expression making for a flexible and powerful search facility.
The query language can be entered directly into IPLM Web or IPLM CLI searches, but unless an advanced search is needed it is usually more convenient to use Query Builder in IPLM Web. More information can be found on the Perforce IPLM query language page in the User Guide. Example queries are shown in each object list/catalog section throughout the User Guide.
Query Builder
Multiple different criteria can be entered into Query Builder, and then run as a search. At the top of the page you can see the underlying query language expression that was generated by the selections in Query Builder.
Queries can be saved for later use as a Saved query. They can additionally be shared with other users by an Admin. Any Saved queries will be displayed on the left hand side of the Advanced search page. These can be selected and run at any time. See Saved queries for more details.
Query language using CLI
The user can add a query filter to list command using the "-q" argument :
> pi ip ls -q '<Query Expression>'
As an example: we can query for the IPs of type CONT in the tutorial Library
We can run the IP list query by directly entering it in the list command.
> pi ip list -q 'dm_type="CONT" && lib="tutorial"' ┌──────────────────────┬──────┬─────────────┬────────────┬───────────────────────────────┬─────────────────┐ │ NAME │ DM │ ALIASES │ CREATED BY │ CREATED ON │ VERSION MESSAGE │ ╞══════════════════════╪══════╪═════════════╪════════════╪═══════════════════════════════╪═════════════════╡ │ tutorial.dac@0.TRUNK │ CONT │ HEAD LATEST │ admin │ 2020-06-19 10:13:45 -0400 EDT │ Initial version │ └──────────────────────┴──────┴─────────────┴────────────┴───────────────────────────────┴─────────────────┘
The query can be saved for later use via the 'pi query add' command.
> pi query add myquery (fill out the template) [QUERY] # The name of the Query is required. name = myquery # An optional description of the Query. description = a new saved query # Only Admin users can share queries # By default, queries are not shared shared = # The Query is required. query = dm_type="CONT" && lib="tutorial"# The Icon is optional. icon = (save and exit the template) Successfully created Query 'myquery'.
Now we can run the query any time using the Saved query.
> pi ip list -sq myquery ┌──────────────────────┬──────┬─────────────┬────────────┬───────────────────────────────┬─────────────────┐ │ NAME │ DM │ ALIASES │ CREATED BY │ CREATED ON │ VERSION MESSAGE │ ╞══════════════════════╪══════╪═════════════╪════════════╪═══════════════════════════════╪═════════════════╡ │ tutorial.dac@0.TRUNK │ CONT │ HEAD LATEST │ admin │ 2020-06-19 10:13:45 -0400 EDT │ Initial version │ └──────────────────────┴──────┴─────────────┴────────────┴───────────────────────────────┴─────────────────┘ Found 1 matching object(s).
More information on Saved queries can be found on the Saved queries page.