BIRT Exchange Forum: variable for the dataSetRow? - BIRT Exchange Forum

Jump to content


 

No Latest Open Poll.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

variable for the dataSetRow? Rate Topic: -----

#1 User is offline   wwilliams Icon

  • Junior Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 23-March 10


Posted 02 February 2012 - 05:39 AM

I am creating a matrix of tasks and the week due. I'd like to loop through vs. hardcoding for all 52 rows (weeks) date1 to date52
I am using this, if (BirtDateTime.week(dataSetRow["date12"]) ==6) (6 corresponds to week 6)
is there a way I can (I have tried many combinations) use a variable for the dataSetRow?
I have also tried utilizing an array, but the values do not reflect the current row when I use it in the detail section of the report.


if (!DataSet.fetch())
	return (false);
.
.

row["date51"] = DataSet.getTimestamp("date51");
row["date52"] = DataSet.getTimestamp("date52");
row["laststartdate"] = DataSet.getTimestamp("laststartdate");	

myArray[1] = row["date1"];
myArray[2] = row["date2"];
myArray[3] = row["date3"];



Is there a means to accomplish this with a crosstab?
I'd like columns reflecting weeks or months, rows reflecting the equipment and the scheduled tasks under the appropriate column.


TIA
0

#2 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 02 February 2012 - 09:34 PM

Can you explain what you're trying to do, a little more in detail?
Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#3 User is offline   wwilliams Icon

  • Junior Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 23-March 10


Posted 06 February 2012 - 07:09 AM

View Postmwilliams, on 02 February 2012 - 09:34 PM, said:

Can you explain what you're trying to do, a little more in detail?


I will give it a shot.
The end result is a report that would show weekly or monthly detail in the following format:

equipment week1 week2 week3 week4 .....
eq1 data data data data
eq2 nodata data nodata
eq2
eq3
.
.
.
It is a visual depiction of what scheduled work and week/month it is due.
I originally used an array, but I didn't find a way to keep the results in a single row for each piece of equipment.
I then changed the SQL to provide 52 columns (one row problem solved), but then I had the task of filtering for each corresponding week.The only solution I found was to hard-code the lot, which I don't want to do.
I guess the plus is I am learning BIRT. BIRT 2.3.2

-W
0

#4 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 06 February 2012 - 12:49 PM

Before writing the SQL to get 52 columns, what did your data look like? Did you ever try a crosstab before using SQL to make you 52 columns? The output you're wanting looks a lot like what a crosstab would do for you if you had data somewhat like:

equipment | project | due date
eq1 | p1 | date1
eq1 | p2 | date2
eq2 | p3 | date1
eq2 | p4 | date2
etc.

Let me know.
Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#5 User is offline   wwilliams Icon

  • Junior Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 23-March 10


Posted 06 February 2012 - 03:16 PM

Michael, the data was rows of the dates due and it spans years. I have to process each record for 52 weeks so weekly tasks are covered, but I need to ignore those outside of current year which would be monthly, quarterly etc,.
I first toyed with a cube and a cross-tab, but didn't find a good way to present the due dates.
I have gone back the original SQL with an array and I seem to be making progress.


eq1 date1
eq1 date2
eq1 date3
.
.
eq1 date52
eq2 date1
eq2 date2
eq2 date3
.
.
eq2 date52
0

#6 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 06 February 2012 - 09:13 PM

So, there's no job description, just a due date that needs to be in the table? If your data is like you show above, you can definitely use a crosstab. I'll make a quick example and post it in here when I'm done. Maybe it'll help.
Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#7 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 06 February 2012 - 09:48 PM

Ok, with data similar to what you gave above, I created what I think you're looking for with a crosstab. I used a scripted dataSet to create a dataSet with 4 pieces of equipment with 52 rows each. I made each "due date" a saturday, starting Jan 8, 2011. To make it random as to which equipment had a due date each week, to better simulate your data, I used a random number generator to decide if there was a due date for the given row. If not, I output a null value. I then made a crosstab with equipment as a dimension, the date field as a dimension (I chose week of year for the grouping), and then used the date as the measure. Hopefully this will get you started in the right direction. Let me know if I'm assuming something incorrectly. If I am, please show me a small sample of what your actual data would look like. Thanks!

Attached File(s)


Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#8 User is offline   wwilliams Icon

  • Junior Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 23-March 10


Posted 07 February 2012 - 05:43 AM

Hi Michael,
could you possibly provide the example in version 2.3.2?
Thanks.
0

#9 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 07 February 2012 - 07:12 AM

Sure. Here ya go!

Attached File(s)


Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

#10 User is offline   wwilliams Icon

  • Junior Member
  • PipPipPip
  • Group: Members
  • Posts: 30
  • Joined: 23-March 10


Posted 07 February 2012 - 08:02 AM

Michael, it is looking good!

Thanks from another Williams!
0

#11 User is offline   mwilliams Icon

  • BIRT Guru
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 10956
  • Joined: 16-May 08


Posted 07 February 2012 - 08:35 AM

No problem. You could clean this up by having another column that definitely has a date for each week and use it as the dimension column. That will get rid of the "0" dimension. Let us know whenever you have questions!
Regards,

Michael

Follow me on Twitter
Friend me on Facebook
Yahoo: mwilliams_actuate@yahoo.com
Google: mwilliams.actuate@gmail.com
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users