Вы находитесь на странице: 1из 6

Answer Parameter Passing

To drill from one Answer to another and pass parameter values from one Answer to another when
clicking on a linked value in a table/pivot table line we use the GoURL command.

Target Report Requirements

For the target report the column values you wish to be passed need to be set to prompted or at least
have some filter on them. In this example we are passing values from the base report for the
department name and job title

Source Report Requirements

We need to create a manual link on a value in the source report. This can be a string or numeric value.
In the case of a numeric value we will need to use a function to cast it to a char. The URL will not
support a numeric value. For example, say we have a report that we want to be able to click on the
employee count, passing the department and job title to the target report. Once clicked, we show a
detail report with only those employees that have that department and job.

Here’s the source report criteria:

1
Here are the steps to get the drill to work.

1. In the case of a numeric value, use the expression builder to cast the numeric count to a char.
For a string value this can be ignored.

CAST(COUNT(Employees."Employee ID")

Once this is done click OK to get back to the criteria page. We need to do this to allow the other
dialogs to know that our value is now a string value and not numeric.

2. Now click on the property icon and change the default data format to HTML.

Note: you can only do this once the CAST has been set

3. Now go back to the expression builder to build out the URL


The basic form of the URL is:

http://SERVERNAME:PORT/analytics/saw.dll?path=REPORT_PATH&Action=Navigate&P0=
NUMBER_OF_PARAMS&P1=OPERATOR&P2=TABLE_NAME.COLUMN_NAME&P3=VALUE_TO_BE_PASSED&
Pn=OPERATOR&Pn=TABLE_NAME.COLUMN_NAME&Pn+2=VALUE_TO_BE_PASSED

Where

 SERVERNAME – web server host name


 PORT – server port (if applicable), 9704 for you
 REPORT_PATH – path for the target report. The easiest way to find this is to use the
Administration > Settings > Manage Presentation Catalog. Now find the report you want
2
to get to and click on the to get to the property page for that report. In the top of the
page you will find the full report path.

If there are space characters in the path or name you will need to escape them using the
%20 code e.g. path =/shared/HR/Parameter%20From
 Action=Navigate – there are other types of action but for the report navigation we use
Navigate
 &P0=NUMBER_OF_PARAMS – this is the number of parameter values you want to pass
 &P1=OPERATOR – this is the operator to be used when comparing the parameter value
to the target column. Valid values are:

Operator Meaning Sign


eq Equal to or in =
neq Not equal to or not in <>, not in
lt Less than <
gt Greater than >
ge Greater than or equal to >=
le Less than or equal to. ⇐
bwith Begins with Begins with
ewith Ends with Ends with
cany Contains any (of the values in &P3) Contain any
call Contains all (of the values in &P3) Contain all
like You need to type %25 in place of the usual % Like
wildcard.
top &P3 contains 1+n, where n is the number of top items Top n
to display.
bottom &P3 contains 1+n, where n is the number of bottom Bottom n
items to display.
bet Between (&P3 must have two values). Between
null Is null (&P3 must be 0 or omitted) Is Null
nnul Is not null (&P3 must be 0 or omitted) Is Not Null

 &P2=TABLE_NAME.COLUMN_NAME – this is target Answer’s


table_name.column_name combination that you want to accept the passed value. If the
string contains spaces you need to escape them e.g.
Departments.”Department%20Name”
 &P3=VALUE_TO_BE_PASSED – this is the value in the current Answer you want to
pass. Again if the value is likely to contain spaces you will need to escape them using a
REPLACE command.

Further parameter values can be passed using the &Pn variables. They are grouped by
threes.
3
 &Pn – operator
 &Pn+1 – target table column
 &Pn+2 – value to be passed

So a second parameter will take the P4,P5 and P6 spots. A third, the P7,P8 and P9 spots.

An example URL construct for our drill from employee count to detail passing Department Name
and Job Title would be:

'<a href='http://127.0.0.1:9704/analytics/saw.dll?GO
&path=/shared/HR/Parameter%20From
&Action=Navigate
&P0=2  passing 2 parameters
&P1=eq
P1 &P2=Departments."Department%20Name"  Note space escaping
&P3='||REPLACE(Locations."Department Name",' ','%20')||'  note REPLACE function
&P4=eq
P2 &P5=Jobs."Job%20Title"
&P6='||REPLACE(Jobs."Job Title",' ','%20')||'>'
||CAST(COUNT(Employees."Employee ID") AS CHAR)||  this is the link value
'</a>'

Everything must be enclosed in a single quote when it is resolved for it to render as a URL link. Notice
the use of pipes (||) to concatenate the parts of the URL. The space character encoding is very
important to avoid a truncated URL at runtime.

At runtime this resolves to:

http://127.0.0.1:9704/analytics/saw.dll?GO&path=/shared/HR/Parameter%20From&
Action=Navigate&P0=2&P1=eq&P2=Departments.%22Department%20Name%22&P3=Shippin
g&P4=eq&P5=Jobs.%22Job%20Title%22&P6=Stock%20Clerk

Note the escaped space characters.

To avoid hard coding the server:port string we


can create a static repository variable in the data
model (rpd) and just reference it in our URL
construct.

Open the model. Manage > Variables. In the


popup dialog select Static (under Repository)

In the right side, right click > New Repository


Variable. Provide the name and the value (in
single quotes.

We can now reference the value from the


presentation layer using the VALUEOF function.

4
'<a href='||VALUEOF("HOSTNAME")||'?GO …

We can now drill from one Answer report to another passing parameter values from the first to the
second.

5
6

Вам также может понравиться