隱藏目錄

Formatting a Report Query

Report queries contain structured information that displays the report in the Report Generator and one or more SQL queries that retrieve information from the SQL database.

You create the queries in a text editor such as Notepad and save them as .crp files.

To format a report query:

  1. Open a text editor such as Notepad.
  2. Create a report query using the following elements:

    Syntax Example
    @[query_identifier]
    @[GroupMembers]
    冷ame [display_name]
    冷ame [User details of selected groups]
    低ompany [company_name]
    低ompany [SOLIDWORKS]
    伶escription [description]
    伶escription 
    [Lists all members of the selected groups.]
    努ersion [version_number]
    努ersion [1.1]
    你rguments
    [
    type name[count] [instruct]
    ]

    Where:

    • type is a predefined argument type

    • name is a variable used in the WHERE element of the SQL query

    • [count] defines how values are returned to the SQL query

    • [instruct] appears in the Report Generator as a user instruction

    A report query can have multiple arguments.

    All components of the argument must be on one line.
    你rguments 
    [
    GroupID TheGroupID[N] [Select groups]
    ]
    刨ql
    [
    ]
    刨ql
    [
    ]

  3. In Microsoft SQL Server Management Studio, create a T-SQL query to retrieve information from the SQL database.
  4. Copy the SQL query and paste it into the 刨ql [ ] section of the report query.
  5. Optionally, modify the WHERE element of the SQL query if you want an argument to be dynamically evaluated when the report is run in the report generator.

    In step 2, the Argument is [GroupID TheGroupID[N] [Select groups]]. You can use the variable name TheGroupID to return data based on the group selected by the user when the report is run.

    To accomplish this, in the following T-SQL query syntax, you would replace G.GroupID = 2 with {G.GroupID, TheGroupID, =, OR}.

    T-SQL query syntax
    WHERE G.GroupID = 2 AND
                   G.GroupID = M.GroupID AND 
                   U.UserID = M.UserID
    Report query syntax
    WHERE {G.GroupID, TheGroupID, =, OR} AND
           G.GroupID = M.GroupID AND
           U.UserID = M.UserID]

  6. Save the query as a .crp file.
  7. Import the .crp file into the Report Generator to run the report.

Report Query Example

The following report query is from Report Examples 1.crp, which is installed to install_dir, by default C:\Program Files\SOLIDWORKS Enterprise PDM.

@[GroupMembers]
冷ame [User details of selected group(s)]

低ompany [SOLIDWORKS]

伶escription
[This query will list all members of the selected groups.]

努ersion [1.1]

你rguments
[
GroupID	TheGroupID[N] [Select group(s)]
]

刨ql
[
SELECT U.Username, G.Groupname, G.Description
FROM Users U, Groups G, GroupMembers M
WHERE {G.GroupID, TheGroupID, =, OR} AND
      G.GroupID = M.GroupID AND
      U.UserID = M.UserID
]

This file contains additional report queries that a user can import into the Report Generator.



提供對此主題的意見反應

SOLIDWORKS 歡迎您提供有關於文件呈現方式、正確性、及完整性的意見反應。請使用下方的表格直接將您對此主題的意見與建議傳送給我們的文件團隊。文件團隊並無法回答關於技術支援的問題。按一下此處來獲得關於技術支援的資訊

* 必要的

 
*電子郵件:  
主旨:   說明主題的意見反應
頁面:   Formatting a Report Query
*意見:  
*   我承認已閱讀且僅此接受隱私權政策,Dassault Systèmes 將遵循此政策之規定使用我的個人資料

列印主題

選擇要列印的內容範圍:

x

偵測到您使用的瀏覽器版本是舊於 Internet Explorer 7。要獲得最佳的顯示,建議您升級瀏覽器到 Internet Explorer 7 或更新的版本。

 不要再次顯示此訊息
x

Web 式說明內容版本:SOLIDWORKS PDM 2014 SP05

要從 SOLIDWORKS 中停用 Web 式的說明並改用本機說明,請按一下說明 > 使用 SOLIDWORKS Web 式說明

要報告在 Web 式說明介面及搜尋中遇到的問題,請聯絡您當地的技術支援代表。要針對個別說明主題提供意見反應,請使用個別主題頁面中的「提供對此主題的意見反應」連結。