Report Query Syntax

The table below illustrates typical syntax for a .crp file.

The following rules apply:
  • Each query in the file starts with @, followed by a unique query name in brackets.
  • Each query contains a number of sections.
    • Sections are written §Label [variable]
    • The order of sections can vary.
    • Section names are case-insensitive.
  • You can use pairs of slash / characters to add comments or separate multiple queries in a single .crp file.

    Text between two pairs of slash characters is ignored when the query is executed.

Syntax Description and Example
@[query_identifier]
Unique identifier for query
@[GroupMembers]
§Name [display_name]
Name displayed in Report Generator Query pane
§Name [User details of selected groups]
§Company [company_name]
Name of company writing the query

Displays in query Properties.

§Company [SOLIDWORKS]
§Description 
[description]
Description

Displays in query Properties.

§Description 
[Lists all members of the selected groups.]
§Version [version_number]
Query version number

Displays in query Properties.

§Version [1.1]
§Arguments
[
type name[count] [instruct]
]
Must be on one line.
Variable declaration section

Can prompt user for input.

§Arguments 
[
GroupID TheGroupID[N] [Select groups]
]
§Sql
[
SELECT column
FROM table_name
WHERE selection_criteria
]
Section defining the T-SQL statement
§Sql
[
SELECT U.Username, G.Groupname,
       G.Description
WHERE {G.GroupID, TheGroupID,
       =, OR} AND
       G.GroupID=M.GroupID AND
       U.UserID = M.UserID]