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)
New table rows based on array in parent.
bgbaird
I have a dataset derived from a datadesign, which is based on an rptdocument.
The output from this dataset includes a compliance event, event date, and a string of employee numbers that participated.
The dataset output looks like this:
eventID eventDate eventAttendees
151 2/12/12 268;254;24;167
173 4/17/10 196
199 1/1/10 392;161;173;443;......up to 350 elements
My requirement is to return this:
eventID eventDate eventAttendee
151 2/12/12 268
151 2/12/12 254
151 2/12/12 24
151 2/12/12 167
173 4/17/10 196
199 1/1/10 392
199 1/1/10 161
199 1/1/10 173
199 1/1/10 443
199 1/1/10 and so on
I don't have any issue splitting the string into an array, and iterating through it.
My challenge lies in creating a distinct result for each of the elements.
Because the dataset is from a datadesign, I can't figure out a way to bind to the parent.
Find more posts tagged with
Comments
mwilliams
You should be able to store the data from this result set into arrays and then use a scripted dataSet to step through them and separate them into rows. Let me know your BIRT version if you have issues with this. I'll try to make you an example.
bgbaird
Hi Michael, Thanks for replying,
I am running Build 2.6.2.v20110326-0603.
I tried scripting this to no avail:
First, in the base data "beforeOpen", I declared 2 arrays, a_data and a_ids.
In the base data "onFetch", I populated those arrays,
Each a_data element was a string concatenated from the first several columns.
Each a_ids element was the string from the "ids" column ("34,52,33" or "12"...).
In the scripted DS "open", I set a rowCount and ColumnCount var to -1.
In the scripted DS "fetch", I parsed a_data[rowCount] into row[rowCount][columnCount]...for a_ids[counter]
I also tried to do it with a single array for each row of base data. row
In a fit of pique, I don't have that source anymore.
I have attached two csv's renamed as txt as samples.
mwilliams
Take a look at this report. Just use your .txt file from above as the source. Don't change the file back to .csv. Just change the location of the file in your dataSource to match where you have the .txt file. Look in the script section of the report outline to see where all the script is. Let me know if you have questions.
bgbaird
Thanks Michael, that's exactly what I'm looking for.
It looks like I didn't do a good job building my array in the first dataset object.
mwilliams
Great. Glad to help!