Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Hidden cascading parameter?
cypherdj
Hi all,
I have created a supervisor report which displays the work load for all users in a given department and takes the following parameters:
- userID,
- departmentID,
- reportDate.
Note that userID and departmentID are cascading parameters, that is, a user can only view the work load for a team he is a supervisor of.
While at design time, I want to be able to select the supervisorID, this parameter should actually be hidden in production, as it will be driven from the user login.
I therefore need to set this parameter to hidden. While this is possible for a "standard" parameter, there does not seem to be the same functionality for cascading parameters.
Any ideas how I could implement this?
Cheers,
Cedric
Find more posts tagged with
Comments
JasonW
Cedric,
Can you post some more details. Where in the cascade is the supervisor id. A work around solution may be to have cascade data set retrieve the userid from session and you could add a hidden parameter for testing. In the beforeOpen for the dataset check to see if you are in the designer and if so use your test parameter and if not look for the userid in session.
Jason
cypherdj
Hi Jason,
I found a different workaround for this, thought I'd posted back, but obviously forgot ;-)
What I did was to remove the userID parameter, and replaced it with a user property. When opening the report design, I set this property to the value from the session. The data set for departments now has a query parameter which is set to the value of the user property.
This seems to work quite well, the only problem I may have is that the java class that opens the report design and sets the user property is generic, that is, it will attempt to set the user property userID for all reports. I'm getting a BirtException when the given report design does not have this user property defined.
I'm guessing I could catch that exception and ignore it,
Cheers,
Cedric
JasonW
Cedric,
You could always check for the property
IReportRunnable design = null;
//Open the report design
design = engine.openReportDesign("Reports/TopSellingProducts.rptdesign");
ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle( );
report.getProperty("yourprop");
Jason
cypherdj
Hi Jason,
yes, I guess I could try to get the value, but will this not raise the same BirtException if the user property does not exist? What I mean is, if that's the case, I might as well try to set it, and suppress the exception if it is raised.
I think I might have claimed victory a bit too soon with this user property.
The report is supposed to produce 2 charts and corresponding tables. When I "hardcode" the userID query parameter in my data set, using the report design plugin viewer to test it, I get the right outcome (see 1st thumbnail)
However, when I run this in my application, capture the parameters and set the userID property, there is no data in the data set used in the 1st chart & table, and the layout of the bars in the 2nd chart is broken (see 2nd thumbnail).
I've included the corresponding report design as well. Are the data sets evaluated when opening the report design? For the parameters, this isn't a problem as I call getSelectionList to get the values, which probably causes a reload of the corresponding data set.
Many thanks,
Cedric
cypherdj
Just to follow up on this, Jason, is this what you meant by using the session?<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/modules/vbulletin/showthread.php?t=11098&highlight=session'>http://www.birt-exchange.com/modules/vbulletin/showthread.php?t=11098&highlight=session</a><br
/>
<br />
I'm wondering if this app context approach would not fix my issue in a better way than a user property would. I'll try this and come back with my findings.
cypherdj
I did try to use the engineConfig, and have put some debugging statements in the beforeOpen method for the relevant data sets.
It appears to get the reportContext hashmap and I can retrieve my value from it, pump it into the query text.
I also put some logging onFetch of each row in the 1st table & chart, and it does load the relevant info (there also is a filter applied, but I'm assuming this is triggered after the fetch to weed out the non matching data).
So the data is there and correct, the preview displays it when hardcoding the reportContext but at runtime within my call to run the report, it doesn't seem to bind the data set to the chart or table.
Could it be caused by not refreshing the binding after modifying the data set to use the user property, then the reportContext HashMap but not refreshing the table bindings and chart bindings?
cypherdj
Still no luck with this report, but I've now realised that even when I hardcode the supervisorID directly in the departments query, my report displays fine in preview but gives me the odd looking screen in my application.
I'm getting extremely confused here, any help would be appreciated,
Thanks,
Cedric
cypherdj
Problem now sorted, I am almost 100% convinced this had to do with data binding. I simply ended up recreating my 1st table and chart, and shazzam, away the problem went.