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)
How to modify queryText if using a Data Object
grather
<p>When creating a report</p>
<p> </p>
<p>I want to make my report editable in Report Studio</p>
<p>And I want to be able to use Dynamic Filters.</p>
<p> </p>
<p>I also want to modify the queryText in the beforeOpen of the Dataset</p>
<p> </p>
<p>So If I don't use a Data Object in beforeOpen of the dataset</p>
<p>So to add some more sql</p>
<p>this.queryText = this.queryText + "AND something = 'one';</p>
<p> </p>
<p>But the same does not work if using a Data Object.</p>
<p> </p>
<p>How can I modify the the query before running.</p>
<p> </p>
<p>I really want to do something depending on the user.</p>
<p> </p>
<p>Gary</p>
Find more posts tagged with
Comments
micajblock
<p>Gary,</p>
<p>Can you please provide more detail on the user requirements?</p>
grather
<p>User Requirements.</p>
<p>At runtime i want to modify the queryText before the query is executed.</p>
<p> </p>
<p>Depending on the the User there are some additional sql I want to add.</p>
<p> </p>
<p>The problem that I am having is being able to modify the queryText when using a DataObject.</p>
<p> </p>
<p>The actual change depending on the User is a separate issue.</p>
<p>Just the changing of the queryText when using a DataObject is not able to do</p>
micajblock
<blockquote class="ipsBlockquote" data-author="grather" data-cid="129873" data-time="1407167797">
<div>
<p>At runtime i want to modify the queryText before the query is executed.</p>
</div>
</blockquote>
<p>This is your technical solution to a user requirement. I would like to understand better the business use case so I can supply the best answer.</p>
grather
<p>Mica</p>
<p> </p>
<p>The user requirement is the user must only see the data he is allowed to see.</p>
<p>In our application we call this the span of control.</p>
<p>A user is assigned a location in a hierarchy (Think directory structure)</p>
<p> </p>
<p>This assignment is defined by a set of ATTRIBUTE1 - ATTRIBUTE10 ((again think directory) a user will be assigned at some level.</p>
<p>anywhere from the top level where everything is available (No ATTRIBUTES ASSIGNED)</p>
<p> </p>
<p>for a leaf node where all 10 ATTRIBUTES are assigned.</p>
<p> </p>
<p>When actually running the report we pass in these attributes where the user as selected what level he want. But it is at or below his assignment.</p>
<p>But the problem I was running into is when in Report Studio the preview did not include these dynamic Filters so the preview was</p>
<p>returning the first of the complete data it was not filtering by what the user could see.</p>
<p> </p>
<p>Hope that helps understand what I was trying to do from a high point of abstraction.</p>
<p> </p>
<p>
</p>
<p>The answer to my question "Thank You Clement Wong"</p>
<p> </p>
<p>Was I was using a Birt Data Object and then in the rptdesign I was using the beforeOpen of the dataset as seen in the rptdesign.</p>
<p>I was incorrectly using the rptdesign - dataset beforeOpen.</p>
<p> </p>
<p>The correct answer is do this in the dataseign file (DataObject)</p>
<p>Modify the queryText in the datadesign - datest beforeOpen</p>
<p> </p>
<p>No when running the report this get fired I can do the needed mods depending on the User as needed.</p>
<p>And this solves my issue.</p>
<p> </p>
<p>
</p>
<p>Mica I would also be interested in other ways of limiting my Preview in ReportStudio to my users alolowed data.</p>
<p> </p>
<p>I am certainly looking for the Best Practices to show up now in my work.</p>
<p> </p>
<p>Gary</p>
micajblock
<p>Have you considered using security on the data object?</p>
grather
<p>Mica</p>
<p> </p>
<p>No I have not. Because I have no idea what security on the data object even means.</p>
<p>Much less how I would implement it.</p>
<p> </p>
<p>Care to aim me to some documentation or provide a simple example what this would take.</p>
<p> </p>
<p>The term is very much what I want. But how to do it ?</p>
<p> </p>
<p>Gary</p>
micajblock
<p>Look at chapter 12 of this manual</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/be/documentation/Manualsihub3/application-developer-guide.pdf'>http://developer.actuate.com/be/documentation/Manualsihub3/application-developer-guide.pdf</a></p>
;
grather
<p>Mica</p>
<p> </p>
<p>I just spent a few moments.</p>
<p>And I want to do the filtering at query time. The reports almost always return data from several tables.</p>
<p>And without the filter at query time millions of rows may be returned.</p>
<p> </p>
<p>If I can apply the filter at query time only the appropiate data is reurned not a bunch where it must then be filtered.</p>
<p> </p>
<p>These are all real time actual data so performance is a priority</p>
<p>So how to do that with security on the data object is great.</p>
<p> </p>
<p>Gary</p>
micajblock
<p>There are numerous ways to tackle this. I would need to know much more about your application before I can give a best practice. Possible solutions are:</p>
<ol><li>adding a script to modify the query in the data object based on the user.</li>
<li>use an instantiated data object with security (this would depend on how frequently the data is updated). This will be the fastest option.</li>
</ol>
grather
<p>Mica</p>
<p> </p>
<p>I did just look at the Data Security</p>
<p> </p>
<p>In this chaper they are talking about using a .data object and filtering the data.</p>
<p>Like I said in my previous post This data is dynamic and must report on live data no caching.</p>
<p> </p>
<p>So my technical solution of adding the appropiate attributes to the query still seems like the best bet.</p>
<p>We have been doing this in our existing BIRT open source reports. (About 5 years worth)</p>
<p> </p>
<p>But what I am trying to do is now take advantage of having the iHub server involved.</p>
<p> So my challenge is modifying my reports to do it the iHub way.</p>
<p> </p>
<p>In the BIRT open source every one of my reports was using a scripted data source. Under our servlet context where I had a connection pool available. And these attributes were done in dynamic sql using a java scripted dataset.</p>
<p> </p>
<p>
</p>
<p> </p>
<p>Now we want to take advantge of the iHub to move our load off the application server itself, the scheduling and the ReportStudio.</p>
<p> </p>
<p>That how I ended up asking such a defined technical question. Which I was close just not in the right place.</p>
<p>Which is adding the script to modify the queryText You #1</p>
<p> </p>
<p>Still up for sugesstion though.</p>
<p> </p>
<p>Gary</p>
grather
<p>So on to my next stumbling block.</p>
<p>Provided I am trying to use a script to update the queryText depending on the User.</p>
<p> </p>
<p>How can I tell iHub what these parameters are.</p>
<p> </p>
<p>I know in my application. I have those know when the user call the ReportStudio .</p>
<p> </p>
<p>But how to make the available.</p>
<p> </p>
<p>Should I pass these as report parameters. I have struggled trying to add report parameters in a dataobject then using that databoject in a report.</p>
<p> </p>
<p>Are there some type of properties (Attributes) I could assign a user when logging in?</p>
<p>In my world the general user will never have access to the iHub console directly. Everything goes through our application.</p>
<p> </p>
<p>Can I set some session variables for this user?</p>
<p> </p>
<p>I know how to get the user. But not sure about how to set and get the needed info.</p>
<p>I just figured out I can do it.</p>
<p> </p>
<p>Gary</p>
grather
<p>Mica</p>
<p> </p>
<p>I thank you so much for all the responses.</p>
<p>This is one of the few times where I have actually gotten a quick response from my question here on the forum.</p>
<p> </p>
<p>Thank you for taking the time to make me ask the proper question and I did recieve the proper answer.</p>
<p> </p>
<p>Again thank you</p>
<p> </p>
<p>Gary Rather</p>
micajblock
<p>Gary,</p>
<p>I would highly recommend for you to discuss this with our Professional Services organization. They can help you with designing the best way to implement your application with the Actuate products. PM me with your company and location and I can put you in touch with the right people.</p>