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)
HELP on this REPORT
SamsGanesh
Hi All ,
I found this forum is very active and lot of useful stuff here , particularly birt admins are doing excellent job here .
I am building a new birt report . I have some question and need tips from you.
1) I have created one new report with script datasource and i have used many datasets ( joint dataset also included ) . When i'm trying this report in the eclipse web viwer , It am getting output from only one simple dataset. Others datasets are not populating the value. I dont know why.
2) In the same report , I am trying to find the date period based on the week of the year. In a year of 52 weeks , if I need the report for the week of 30th of 2010 , I should translate this 30th week of 2010 into a date range like 12/7/2010 to 20/7/2010. Is there a function orcode to translate this week into date range ?
3) In the same report I want to display items in the tree like structure
Example :
Parent1
Child1
Child2
Parent2
Child21
Child22
From query , I have retrived values like ,
Parent1
Child1
Parent1
> this repeatation of parent record should be hidden
Child2
Parent2
Child21
Parent2
> this repeatation of parent record should be hidden
Child22
I want to show the parent record only once and child record offset to the parent. Ideally parent record should not be repeated.
Can you please give me some light ?
Thank you williams
Regards
Ganesh
Find more posts tagged with
Comments
mwilliams
Hi Ganesh,
For number 1, which dataSet is showing up? Is it a scripted dataSet or a different type? Are you getting any errors at all with the others not showing?
For number 2, it seems that you could just group your table on the parent field and display the children in the detail section of the table. Let me know if you have issues or if this doesn't work for you.
SamsGanesh
Thanks williams.<br />
<br />
For question 1 : It is a scripted datasource. The rpt contains different dataset. One is direct dataset[without joints] which works fine .The problamatic dataset is the jointdataset. It is not showing any error. you can notice it in the rpt attached in the original post. The problematic dataset name is "DATA SET" in the code.<br />
<br />
<br />
I also had a question on the "week to date coversion" in the original post. Is there a birt function or javascript function which can handle following conversion ?<br />
<br />
I am trying to find the date range based on the week of the year. In a year of 52 weeks , if I need a report for the week of 30th of year 2010 , I should translate this 30th week of year 2010 into a date range something like 12/7/2010 to 20/7/2010. Is there a birt function or birt code to translate this week into date range ? <br />
<br />
<br />
<br />
<br />
Regarding group by option in the table as you suggested :<br />
<br />
I have tried with grouping option with table , <br />
<br />
<br />
Actually output what I need is something like this :<br />
<br />
Column1 Column2<br />
Child1 Description<br />
Task1 Task description<br />
Task2 Task description<br />
Child2 Description<br />
Task1 Task description<br />
Task2 Task description<br />
<br />
but when grouping and hiding details row is implementated as like you suggested , i'm getting the following format ,<br />
<br />
<br />
<br />
Column1 Column2<br />
Child1 <strong class='bbc'>[This value goes missing] </strong><br />
Task1 Task description<br />
Task2 Task description<br />
Child2 <strong class='bbc'>[This value goes missing</strong>] <br />
Task1 Task description<br />
Task2 Task description<br />
<br />
YOu can notice I am not getting the child1's description and child2's description goes missing
mwilliams
Does your sample report above run? Or does it require an external java file for your dataSets? What is your BIRT version? If I can't run the above file, can you show me exactly how your data looks in your dataSet, I'll be able to help with the grouping better if I know that.
Sorry, I accidentally skipped number 2. How are you grabbing "week 30"? My initial guess is that you'll need to grab a date that is returned, figure out what day of week it is and then figure your range value in script, but this is just my initial assessment.
SamsGanesh
thanks williams<br />
<br />
It is birt version 2.1.2<br />
<br />
It does not need any external java files or Library. But you can modify or remove sql<br />
<br />
<br />
<strong class='bbc'>Regarding date conversion :</strong><br />
<br />
The week number is the input field by the end user. he will type i need 30th week report of year 2010.<br />
<br />
I need to convert that into date range to fetch the data from the database.<br />
<br />
<br />
<strong class='bbc'>Regarding the grouping structure :</strong><br />
<br />
I am attaching a screen shot which demonstrates grouping
mwilliams
So, you use SQL? Not a scripted dataSet? Or do you use a scripted dataSet to hook to your SQL database? If I can't run the report, it won't do me much good probably. I'll need one I can access the data for to see your issue.
As for the date, if you're using SQL, you could probably use a week function to only return the dates from a given week if possible. Otherwise, you'll have to bring in your parameter where your user says which week they want, then depending on what you call the first week (first 7 days or if 1/1 is on Thurs, 1st week is only 3 days long), you'll need to calculate what day of the year you'll need, use javascript to pull the date range and then modify your scripted dataSet parameters or your SQL parameters or your filter for your flat file or whatever database style you're using.
As for the grouping structure, is that what your data looks like coming in? Or is that your report output that you have so far? What I want to see is exactly how it is in your dataSet editor's "preview" screen.
SamsGanesh
thanks Williams.
I am making progress in the grouping. Will confirm it shortly
Regarding week to date conversion. I found a custom REGULAR java script founction in the internet. I will paste that at the bottom. How to incorporate this function inside birt. So far I used only inbuilt javascript funtion in the birt. Please help me
function isoweek(kou) {
var year=parseInt(kou.substring(0,4),10);
var week=parseInt(kou.substring(4,6),10);
// JavaScript weekdays: Sun=0..Sat=6
var jan10=new Date(year,0,10,12,0,0);
var jan4=new Date(year,0,4,12,0,0);
var wk1mon=new Date(jan4.getTime()-(jan10.getDay())*86400000);
var startdate=new Date(wk1mon.getTime()+(week-1)*604800000);
var enddate=new Date(startdate.getTime()+518400000);
var datesout=new Array();
datesout[0]=dmyformat(startdate);
datesout[1]=dmyformat(enddate);
return datesout;
}
function dmyformat(kou) {
return (kou.getDate()+100).toString().substring(1,3)+'/'
+(kou.getMonth()+101).toString().substring(1,3)+'/'
+kou.getFullYear();
}
mwilliams
One thing you could do is you can use an external javascript file and include the file as a resource on the "resources" tab of the property editor for the report design. Then, you can call this function from within your report.
SamsGanesh
Thanks williams.
Since my version is birt 2.1.2 , when I goto resources tab , I am able to add only .properties files and .jar file there. There is no option to add javascript file extension there.
There must be someother way to add javascript in version 2.1.2 ....Any suggestions ?
Thanks
Ganesh
mwilliams
I believe you can also define a javascript function in a text control and use it within your report.
SamsGanesh
Thanks Williams. You have been so helpful.
I solved all three issues !
mwilliams
Great to hear!! Let us know whenever you have questions!
bmeyns
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="73784" data-time="1298499010" data-date="23 February 2011 - 03:10 PM"><p>
One thing you could do is you can use an external javascript file and include the file as a resource on the "resources" tab of the property editor for the report design. Then, you can call this function from within your report.<br /></p></blockquote>
How can I use a function from an external resource (Javascript) on showing the report-parameter screen (so, before the report is started to be generated)?<br />
Seems the external resources defined on the report design are only loaded when the reports starts executing, not allready when showing the report parameter-screen.
mwilliams
Hi bmeyns,
What are you trying to do?
bmeyns
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="74268" data-time="1299170628" data-date="03 March 2011 - 09:43 AM"><p>
Hi bmeyns,<br />
<br />
What are you trying to do?<br /></p></blockquote>
<br />
Hi mwilliams, I've a report-parameter "pCostCenter" (pulldown) that should be filtered according to the logged-in user. I've created a function "getLoggedInUsername()" that gets the username, so I can now filter my CostCenter resultset according to the logged-in user.<br />
Should be nice (not a must) if I could include this function into an external script (so I can reuse this easily for other reports).
mwilliams
If you can get ahold of your username external to BIRT, you could pass it through a parameter and use this parameter to limit your resultset. You could always create an external class file with your function, jar it, and then use that.
bmeyns
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="76258" data-time="1303844465" data-date="26 April 2011 - 12:01 PM"><p>
If you can get ahold of your username external to BIRT, you could pass it through a parameter and use this parameter to limit your resultset. You could always create an external class file with your function, jar it, and then use that.<br /></p></blockquote>
<br />
Thx, I'll keep in mind the "external jar" alternative for next developments.<br />
<br />
BTW: the external .js problem for the beforeOpen on the parameter-selection should be fixed on BIRT 6.2.2 (<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=324546'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=324546</a>)<br
/>
I'll give it a try