Looping through a dataset

crowt999crowt999 Junior Member
edited December 31, 1969 in Designing Analytics Reports
Hi all,

I have a need to search my dataset before displaying the rows on a report. If I find a row that I do not want to show, I can set a column to "N" or something like that.

I am using a scripted data set, and my basic idea was to loop through all of the rows retrieved in the 'beforeClose' event, secrching for the ones I do not want to show on the report.

Does anyone know if this is possible, or will work? Can I loop through the dataset as kind of a "pre-process" to clean up the data?

Many thanks


  • VirgilVirgil Administrator EM admin
    edited December 31, 1969
    Hi Dean,

    Since you're using a scripted data set, you can decide in the onFetch method whether on not to add this row of data. Otherwise, you could double-click the data set and apply a filter there... or you could apply the filter by selecting a table on the report and setting the filter property.

    Virgil Dodson
    OpenText Analytics Developer Community

  • JMaleskiJMaleski Junior Member
    edited December 31, 1969
    I have a similair question about manipulating the data set before hitting the onFetch method. I am using a CSV data source to display numerous columns from an excel report. How ever, the Excel report contains misc garbage fields at the beginning (example follows):

    GarbageCell1 | foo
    GarbageCell2 | more foo
    GarbageCell3 | supa foo
    RealCell1 | RealCell2 | RealCell3 | RealCell4
    Bob | Marley | Singer | Deceased
    Janice | Joplin | Singer | Deceased

    Is there a way to inside the Data Set Event Handler to remove these garbage rows? I have the report working if I manually remove the rows but am having the report throw an expection when the rows are there.
  • crowt999crowt999 Junior Member
    edited December 31, 1969

    Thanks for the reply - but my question was not clear enough (sorry)...

    In my dataset - I will have 2 rows that will have offsetting values

    Tran Value
    TRAN1 10000
    TRAN2 -10000

    to remove the "noise" on the report, we need to remove these offsetting rows from the report. I was thinking more along the lines of retrieving the entire data set, and then iterating through it to find these matching entries that net to 0, and set another field in the data set to "N" (then filter on that)

    At this point, I am going to set up an array when the report is rendered with these offsetting transaction types, then write a function that will search through the array for the value. If I find the value, the function will return an "N" (or something) and then I am hoping that I can filter/hide the rows based on the returned value of the function.

    If you know of a way to do this before getting to the report rendering phase, please let me know.

    Thanks for the reply!
  • JMaleskiJMaleski Junior Member
    edited December 31, 1969
    I'm not sure if this will help you Dean, but I wanted to post a follow up to my issue.

    I was stuck in the mindset of using built in BIRT functionality to address my problem and forgot that I can simply open the file using a inputstream, remove the lines mauanly from the CSV file, then re-save it with just the core data I want to use in the Data Set.
Sign In or Register to comment.