none
Align ReportItem table records within rdlc using C# 2005 RRS feed

  • Question

  • Hi guys

    Here is another question that goes hand-in-hand with my earlier post.

    I have two tables on one rdlc report. I have placed the two tables next to one-another. I have created a parameter screen where the user selects amongst others a start and end date to be processed. Both tables in question are validated against the selected data range.

    Now I have a couple of problems:
    1. Although I have specified within the SELECT statment that the date in questions should >= @Param1 and <= @Param2, the date selected as start date is overlooked. E.g. Should the start date read 2009-01-15, all records on this date is ignored. Records from 2009-01-16 onwards are processed. Surely this date should be inclusive, like the end date is. What am I missing here?
    2. This problem is a big one. I need to come up with some sort of algorithm, and then figure out where to put it in the report/code. Because we are working the unspecified date ranges, they can range from a couple days apart upto a year apart. The problem is that for a certain date, one of the two datasets (any one) may contain records, while the other one does not. The algorithm that I have in mind  goes something lik this:
      • Sort table 1 and table 2 by datefield:
      • Read date-value on table 1.
      • Compare date-value of table 1 with the date-value of table 2.
        • If they are equal process table 1 while date-value is the same, write record for table 1. Process table 2 while date-value is the same, write record for table 2.
        • If date-value on table 2 is greater, process table1 while date-value is the same and write the record for table 1, and create a blank record in table 2.
        • If date-value on table 2 is less, process table 2 while date-value is the same and write  blank record for table 1 and write the record for table 2.

    This is a rough outline of the algorithm I have in mind, and may still tweak it, when I give it some more thought. Having said this, how and where do force a blankline on a table? Where can I insert this code?

    Your ideas and suggestions will be appreciated.

    Many thanx.


    It's not the blowing of the wind that determines your destination, it's the set of the sail. J Rohn
    Wednesday, October 29, 2008 12:53 PM

Answers

  • 1.   Remember that SQL is always a DateTime value, it does not seperate date from time.   So be sure the start date being sent in starts at   2009-01-15 00:00:00AM   to  2009:-01-16 11:59:59PM

    There are several ways to format date and time in your application, and based on what you pass in, SQL will convert to a value it can use.  


    2.  In regards to adding blank lines to a table, if your not going to do it SQL side, then do it in code, before you provide the datasource to the report.  Trying to do something like that in the report itself would be too complex.

    In code, to do this, off the top of my head, you'd basically  Take your primary datatable, and create an array from the datefield column.   Then grab your table that should have blanks, and loop through it, comparing it's datafield to the array.  If it's not in the array, add a row object to the datatable, and set it's datafield value to the missing field value in the array.



    The whole thing would probably be easier to do in SQL beforehand.
    Living my life at 123mph in 11.15 seconds
    • Marked as answer by HennieSmit Thursday, October 30, 2008 5:28 AM
    Wednesday, October 29, 2008 5:03 PM

All replies

  • 1.   Remember that SQL is always a DateTime value, it does not seperate date from time.   So be sure the start date being sent in starts at   2009-01-15 00:00:00AM   to  2009:-01-16 11:59:59PM

    There are several ways to format date and time in your application, and based on what you pass in, SQL will convert to a value it can use.  


    2.  In regards to adding blank lines to a table, if your not going to do it SQL side, then do it in code, before you provide the datasource to the report.  Trying to do something like that in the report itself would be too complex.

    In code, to do this, off the top of my head, you'd basically  Take your primary datatable, and create an array from the datefield column.   Then grab your table that should have blanks, and loop through it, comparing it's datafield to the array.  If it's not in the array, add a row object to the datatable, and set it's datafield value to the missing field value in the array.



    The whole thing would probably be easier to do in SQL beforehand.
    Living my life at 123mph in 11.15 seconds
    • Marked as answer by HennieSmit Thursday, October 30, 2008 5:28 AM
    Wednesday, October 29, 2008 5:03 PM
  • Thanx.

    SQL here I come. :)


    It's not the blowing of the wind that determines your destination, it's the set of the sail. J Rohn
    Thursday, October 30, 2008 5:28 AM