Highlighted
garecanbp Super Contributor.
Super Contributor.
1087 views

BIRT query get current active project

Jump to solution

Can we set query at BIRT to get current project? For example I set query like this

SELECT ProductName, PassedCount

FROM TM_V_ExecDefRuns

WHERE ProductName = 'A'

If user from project B who using the template, can the template automatically set the template to get ProductName 'B' only, and such other user from different project.

Thanks

0 Likes
2 Solutions

Accepted Solutions
Micro Focus Contributor
Micro Focus Contributor

RE: BIRT query get current active project

Jump to solution

Hi,

in addition to Hubert's reply on using $PROJECTID in an advanced query in SC, the current project id is also passed to the BIRT engine and can be accessed in BIRT templates using params["currProjectID"]

Regards,
Roland Kern

Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution

Hi garecanbp,

 

Look into one of the standard reports shipped with Silk Central. For example, download from the Report Templates view Execution Status Overview.rptdesign.

Open it with the BIRT report designer and go to the Data Explorer. Edit the data set ED Run Info.

 

The query text shows how to use query parameters, e.g.

etp.ParentNodeID_pk_fk = ? and etn.ProjectID_fk = ?

 

In the parameters tab you can see how to set values to the parameters. Number and order of parameters must match the placeholders in the query. In this case param1 has default value params["rp_execNode_Id_0"] and param2 has default value params["currProjectID"]

 

Following this example you should be able to use BIRT parameters in your custom SQL query.

 

Regards,

Hubert

0 Likes
12 Replies
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution

Hi garecanbp,

There are several parameters, including the project id, which can be accessed in SC reporting.

Use $PROJECTID to access the ID of the currently selected project.

 

For more information see the documentation here:

http://documentation.microfocus.com/help/topic/com.microfocus.sctm.doc/SCTM-B00D0599-SQLFUNCTIONSFORCUSTOMREPORTS-CON.html?cp=9_0_2_5_3_1_1_0_1

 

Regards,

Hubert Inreiter

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: BIRT query get current active project

Jump to solution

Hi,

in addition to Hubert's reply on using $PROJECTID in an advanced query in SC, the current project id is also passed to the BIRT engine and can be accessed in BIRT templates using params["currProjectID"]

Regards,
Roland Kern

garecanbp Super Contributor.
Super Contributor.

RE: BIRT query get current active project

Jump to solution
Thanks Roland,
but I haven't yet understand it.
Could you give example to implement it to the BIRT query?
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution
Hi garecanbp,

I recommend using one of the standard reports installed with Silk Central as example. Open with BIRT report designer the report template "Execution Status Overview.rptdesign". Edit Data Sets > ED Run Info, in "Query" tab and "Parameters" tab you can see how this is used.

Regards,
Hubert
0 Likes
garecanbp Super Contributor.
Super Contributor.

RE: BIRT query get current active project

Jump to solution
Thank you Hubert, now I can pass parameter from Central to BIRT. How about placeholder? Could we pass it to BIRT? I have concern especially about ProjectID. If I set ProjectID from parameter, it can be changed and other project can be seen from report by reporter even though he don't have access.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution
Hi garecanbp,

Placeholders are resolved before the data is sent to the BIRT engine. If you use the placeholder $PROJECTID the BIRT report receives the ID of the currently selected project. It can accessed as parameter.

I am not sure if I understand your concern. Users which have the permission to write advanced queries or modify report templates must take care that the result of their reports do not expose any unwanted data. Therefore, give the permission to create and modify reports to special users only. The majority of the users should only be given read access to the report area.

Regards,
Hubert
0 Likes
garecanbp Super Contributor.
Super Contributor.

RE: BIRT query get current active project

Jump to solution
Hi Hubert
So I can put placeholder ($PROJECTID) and pass it as query parameter on BIRT. Is the way same? Use rp_[placeholder name]?
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution
Hi garecanbp,

The current project ID can be accessed as parameter "currProjectID". It is available to BIRT reports automatically . You don't have to add it as a separate parameter. See also Roland's comment on this.

Regards,
Hubert
0 Likes
garecanbp Super Contributor.
Super Contributor.

RE: BIRT query get current active project

Jump to solution

Hi Hubert,

"currProjectID" can be accessed like this?

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution

Hi garecanbp,

 

Look into one of the standard reports shipped with Silk Central. For example, download from the Report Templates view Execution Status Overview.rptdesign.

Open it with the BIRT report designer and go to the Data Explorer. Edit the data set ED Run Info.

 

The query text shows how to use query parameters, e.g.

etp.ParentNodeID_pk_fk = ? and etn.ProjectID_fk = ?

 

In the parameters tab you can see how to set values to the parameters. Number and order of parameters must match the placeholders in the query. In this case param1 has default value params["rp_execNode_Id_0"] and param2 has default value params["currProjectID"]

 

Following this example you should be able to use BIRT parameters in your custom SQL query.

 

Regards,

Hubert

0 Likes
garecanbp Super Contributor.
Super Contributor.

RE: BIRT query get current active project

Jump to solution
Hi Hubert,

params["currProjectID"] could we use it for name too? Like params["currProjectName"]
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: BIRT query get current active project

Jump to solution

Hi garecanbp,

 

No, currProjectId is a standard parameter, currProjectName is not.

 

Regards,

Hubert

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.