Home
Analytics
Wrapped.java.lang.IllegalArgumentException
Bharath406
Hi,
I'm trying to build a custom column so that I can aggregate the crosstab data by week. I'm pulling the data from RTC repository.The code snippet is shown below
var dt = new Date(row["Date Gen Set::DateRange"]);
var day = dt.getDay();
if(day == 0){
var dt1 = new Date(dt.setDate(dt.getDate()));
} else if(day == 1){
var dt1 = new Date(dt.setDate(dt.getDate()-1));
} else if(day == 2){
var dt1 = new Date(dt.setDate(dt.getDate()-2));
} else if(day == 3){
var dt1 = new Date(dt.setDate(dt.getDate()-3));
} else if(day == 4){
var dt1 = new Date(dt.setDate(dt.getDate()-4));
} else if(day == 5){
var dt1 = new Date(dt.setDate(dt.getDate()-5));
} else if(day == 6){
var dt1 = new Date(dt.setDate(dt.getDate()-6));
}
(dt1.getMonth()+1)+"/"+dt1.getDate()+"/"+dt1.getFullYear();
When I try to preview the result it is throwing an error "Wrapped.java.lang.IllegalArgumentException ".
If I use the same code for a report which is designed based on a CSV data it works fine without any errors.
Any clue?
Find more posts tagged with
Comments
mwilliams
Hi Bharath,
Does it give you any sort of error stack that you can paste in here? I'm guessing there's not a way for you to reproduce this for me to run and see?
Bharath406
Hi Michael,<br />
<br />
The trace is too long so I'm just attaching a spreadsheet that shows you the trace. <br />
<blockquote class='ipsBlockquote' ><p>I'm guessing there's not a way for you to reproduce this for me to run and see?</p></blockquote>
Right, as I said even if I give you the CSV data, it will run without any issues.
mwilliams
Bharath,
Week is an included grouping option for a crosstab date dimension. That is the week of year though. Are you wanting to do 1-7, 8-14, etc? Or Sun-Sat weeks?
Bharath406
Yes Michael the option included in crosstab doesn't serve our needs. We would like to have sun - sat weeks. But the starting date and ending date should be the "From" date and "End" date we give as parameters and within that range it should be aggregated with sun - sat weeks.
Just to avoid confusion, for example consider From 5th May 2010 To 31st May 2010. So first grouping should be from 5th May to 8th May and the last grouping from 30th May to 31st May. And within this range it will be 9th to 15th, 16th to 22nd and 23rd to 29th.
Bharath406
Hi Michael,
Anything on this?
mwilliams
Bharath,
Sorry for the delay. Was in the process of upgrading my OS to Windows 7. If your current method isn't working, you could try just create computed columns in your dataSet for Year, Month, Week, Day, etc that you want to use in your crosstab. Then just build your dataCube using these as dimensions rather than the actual date. Hope this helps.
Bharath406
Hi Michael,
I feel the logic I'm using will fit into our requirement perfectly. But I'm just wondering what this error is all about.
One pointer I can give you is, in the dataset generated from the CSV data, row["Date Gen Set:ateRange"] appears to be of string type. But when I'm directly running against RTC repository it is of Date type.
mwilliams
Bharath,
So, when you use CSV, you're using a string type for the date? If you use a date type, does it fail?
Bharath406
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Bharath,<br />
<br />
So, when you use CSV, you're using a string type for the date? If you use a date type, does it fail?</p></blockquote>
Yes Michael, I created a computed column of date type and tried to use it. Its throwing a different error.<br />
Attaching the CSV data and design file for you to have a look.
mwilliams
Bharath,
The standard week function does do Sunday though Saturday. The problem with your computed column using the CSV was with the way you were trying to make the string date a date. I think I might be confused on what you're trying to do now. Are you wanting the crosstab to actually group on week of year? Or to display every date, but do calculations of the entire week? Let me know.
Bharath406
Michael, my bad. I was just trying to reproduce the error with the CSV data so that you can have a look at it.
Basically, I'm looking for this:
Just to avoid confusion, for example consider From 5th May 2010 To 31st May 2010. So first grouping should be from 5th May to 8th May and the last grouping from 30th May to 31st May. And within this range it will be 9th to 15th, 16th to 22nd and 23rd to 29th. And each aggregated row should show the starting day of the week. Something like this:
| | S1 | S2 |
| 5th May 2010 | 2 | 3 |
| 9th May 2010 | 1 | 0 |
| 16th may 2010 | 1 | 3 |
| 23nd May 2010 | 1 | 1 |
| 30th May 2010 | 0 | 1 |
mwilliams
Bharath,
What is your BIRT version? I'm pretty sure I know what you're wanting now. Sorry about getting confused!
Once you tell me your BIRT version, I'll make a report with the sample database that does what I think you're trying to do.
Bharath406
I should have been specific
. Anyways, I'm using BIRT 2.3.2.2
mwilliams
Bharath,
Take a look at this report. I think it does what you're looking for. I wasn't sure how you wanted to handle multiple months, so I just left it in a way that if the 30th of one month and the 1st of the next are in the same week they'd have the same "week start" so they'd be in the same row of the crosstab. Let me know if this isn't what you're wanting or if you have questions.
Bharath406
Perfect Michael
. Itz working great. Thanks a lot. I need to check on my production environment and will update you if I see any issues. Thanks again.
mwilliams
Great to hear! Let me know if there are issues on the production environment.
Bharath406
One quick question Michael. The computed column WeekStart is a string. As a result the sorting in the crosstab is messed up. Can we do anything about this?
Please check the Screenshot.
mwilliams
Bharath,
Sorry. If you look at my design, I have an "attribute" of the actual date added to the "week start" dimension in my dataCube and a sort condition on my crosstab to make sure they're sorted in the correct order based on this attribute. Let me know if you have any other questions!
Bharath406
Ah.. I missed that. Sorry. Itz all fine now