Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
DataSet Parameters from URL
Sundeep Govathoti
<p>Hi,</p>
<p> </p>
<p>We are currently trying to embed an iHUB dashboard inside our multi-tenant web application. We would like to publish one copy of the dashboard and have each of our clients use the same dashboard but view their own data.</p>
<p> </p>
<p>One way to accomplish this is to replace the query text of the dataset being used for the dashboard with the client name. We would like to pass this client name through the JSAPI.</p>
<p> </p>
<p>Ideally I would create a 'schemaname' parameter and replace that during run time based on the parameter value returned from the URL. I have the below in the 'beforeopen' of the dataset.</p>
<p> </p>
<p class=""><span>this</span>.queryText=<span>this</span>.queryText.replace(<span>"cornell"</span>,params[<span>"schemaname"</span>].value);</p>
<p class=""> </p>
<p>However, I am not clear about the following two issues - </p>
<ol><li>How do I pass the parameter value to BIRT using JSAPI (syntax)?</li>
<li>What should I do to store this parameter value in the datadesign file so that i can use this value in my dataset?</li>
</ol><p>I apologize in advance if this information is basic, but I am a newbie.</p>
<p> </p>
<p>Thanks for your help.</p>
Find more posts tagged with
Comments
Clement Wong
<p>Yes, one option is to use a single dashboard and a single .datadesign (if you're using live data).</p>
<p> </p>
<p>For tighter security, you may want to consider using the user's logged in name or the user's user groups to determine the client name instead of passing in a paramter.</p>
<p> </p>
<p>In a report design (.rptdesign) or data design (.datadesign), you would be able to access the username who is logged into iHub via <span style="font-family:'courier new', courier, monospace;"><strong>reportContext.getAppContext().get("ServerUserName")</strong></span>. </p>
<p> </p>
<p>You can also access the user's user groups via <span style="font-family:'courier new', courier, monospace;"><strong>reportContext.getAppContext().get("ServerContext").getUserRoles()</strong></span>. Yes, the call is <em>getUserRoles</em>, but we changed the naming of Roles to User Groups starting with iHub 3, and the method name didn’t change. </p>
<p> </p>
<p>If your user had a user group name assigned with the Client ID such "CID_12345". You would be able to use a RegEx to extract the "12345" from the user group names.</p>
<p> </p>
<p>From there you can pass in that value (in my example, "12345" into your query via the beforeOpen replacement of the SQL query.</p>
<p> </p>
<p>You have another sub-option that allows you to pass session info to reports. To pass session variables from Information Console to your BIRT report, in your case, the user’s Client ID, all you would need is just a few lines of code in a JSP. After you have authenticated the user in Info Console, you can AJAX a call to a JSP to set the variable(s).<br><br>
In this sample JSP below, you’ll see that the session parameter “myParam†value is set to “Hi there!â€. Then the page is redirect to a report.<br>
</p>
<pre class="_prettyXprint">
<jsp:useBean id="SessionDefaultParameterValue" scope="session" class="com.actuate.parameter.SessionLevelParameter" />
<%
SessionDefaultParameterValue.setParameterValue("myParam","Hi there!");
%>
</pre>
<p>The setting of this session variable can be anywhere that is in a common Information Console page. You would only need it to be called once (or multiple times if you want allow it changed during the session).<br><br>
You are NOT limited to just one parameter, and you can set as many parameters as you need.</p>
<p> </p>
<p>You can then use this variable in your report design or data design.</p>
<p> </p>
<p> </p>
<p> </p>
<p>If you are OK with cached data, another option is to use one single dashboard, one Data Design, but have the Data Objects (.data) scheduled for each client. For each .data file, the iHub Volume file privileges would be used to assign (R)ead privileges to that specific Client.</p>
<p> </p>
<p>Then when each client logs in, they only have access to their own .data. They would be able to see the dashboard with their data.</p>
<p> </p>
<p> </p>
<p>There might be other options too. We can setup a call with one of my resources to discuss further.<br><br>
</p>