Description:
How can I pass a parameter (e.g. project id) to a portlet page in Clarity?
I have created a graph portlet, based on a NSQL query. In this NSQL query, I am using a parameter, that selects the specific project, and shows the right information. The portlet shows actuals vs. budget information.
To test the parameter, I have input the two needed parameters in the filter. Filling out the needed information in the portlet shows the correct information in the portlet. The parameter and the NSQL query seem to work fine together.
From the project list page, I have created a link to the portlet page. This should give the correct portlet page on the screen, and pass the right parameters to the portlet:
Example URL
http://localhost/niku/app?action=asp_test_budget_graph¶m_revision_parameter=0¶m_unique_parameter=5000121
revision parameter=0
unique parameter=5000121
The link opens the created portlet page, but does not pass the the information from the URL to the portlet parameter.
How can I achieve that the portlet page accepts parameters given in the above url, and shows the requested information in the portlet?
Solution:
To pass parameter in the URL to a portlet , add to the NSQL query in the WHERE clause
(yyy_project_id = @WHERE:PARAM:XML:INTEGER:/data/xxx/@value@)
NOTE: yyy_project_id is the column in the query containing the project id.
and xxx is the value of the parameter label in the url when the page lauches. xxx=0000000 shows in the url where xxx is to be used in the nsql and 0000000 is the current id of the project being displayed.
In the described example, it will be:
WHERE
(revision_id = @WHERE:PARAM:XML:INTEGER:/data/revision_parameter/@value@)
and
(unique_parameter = @WHERE:PARAM:XML:INTEGER:/data/unique_parameter/@value@)
And make the portlet page as Linkable and in the Link Parameter section define two parameters with id revision_id & unique_parameter.