How can I hide a table row if subreport returns no data

  • I have a report that pulls data from a SQL Server table. Then, a subreport is passed the value of the each key field from that result set (such as a sku number) and the subreport queries an oracle database using that key value (sku number) and may or may not return data depending on the existence of that data in the oracle table.

    My question is this. How do I suppress the empty detail line in the main report if the subreport returns no data ? Using the visibility setting is not working for me because there is no field value to check. Can anyone help?

  • jeffroper,

    Have you found a solution to this problem? I'm faced with the same issue. The suggestions I've come across all deal with expressions in the main report that evaluate the subreport's dataset. But in your case (and mine) the subreport's dataset is not available in the main report. In my case the subreport dataset is being populated in the subreport processing event handler.

    Can the table row in the main report that contains the subreport be referenced in code from the subreport processing event handler? The event handler is passed a sender object which seems to be the main report but I don't know how to access the table or table row (and its "Hidden" property) of that object.

  • Here is how I had to solve the problem:

    I had to create a new report to mimic the existing report as best as I could. I created a stored procedure on the SQL Server database, and joined to the Oracle tables through a linked server. So, instead of two datasets, one representing the query from the SQL table, and the subreport with the query from the Oracle database table, the stored procedure accomplishes both and returns the data in one result set.

    I could not figure out any other way to do it.

  • Larry.Jones (7/9/2008)


    jeffroper,

    In my case the subreport dataset is being populated in the subreport processing event handler.

    Can the table row in the main report that contains the subreport be referenced in code from the subreport processing event handler? The event handler is passed a sender object which seems to be the main report but I don't know how to access the table or table row (and its "Hidden" property) of that object.

    Any solution for this? I'm facing exactly the same issue and have found no solution. I really need to hide the main row for cases when "on-the-fly" created subreport has no rows.

    I have also been trying to manipulate Main datasets Table and removed a row from there, but I'm not able to "refresh" the changes in datatable to reportviewer control.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply