Results 1 to 7 of 7

Thread: [RESOLVED] How to show empty columns at crosstab ?

  1. #1

    Thread Starter
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263

    Resolved [RESOLVED] How to show empty columns at crosstab ?

    Hi, there!

    I need to show some colums at crosstab, but I've had some problems, the description of the situation is:

    1) I execute the CR report from an asp page which sends me the parameters used to execute a SP at SQL Server;

    2) The result from SP execution has values this respective months...

    Here starts the problem :rooleyes:

    This result has some months absent to some groups....

    For example:

    Group 1: Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez (all months)

    Group 2: Jun, Jul, Oct, Dez (only this months)

    So the Reports shows me:

    Group 1: Jan Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez
    1 2 4 6 7 3 1 3 4 5 6 7
    Group 2: Jun, Jul, Oct, Dez
    19 3 1 1
    That's ok, but it isn't fine....

    I need that report shows me:

    Group 1: Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez
    1 2 4 6 7 3 1 3 4 5 6 7

    Group 2: Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez
    19 3 1 1

    or

    Group 1: Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez
    1 2 4 6 7 3 1 3 4 5 6 7

    Group 2: Jan, Feb, Mar, Apr, Mai, Jun, Jul, Aug, Sep, Oct, Nov, Dez
    0 0 0 0 0 19 3 0 0 1 0 1

    How can I do that, without any change on the SP ? The table has no values at the absent months, better saying, the table doesn't have these months...

    I'm using CR 8.

    Thanks in advance,

    João Luiz
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  2. #2
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Re: How to show empty columns at crosstab ?

    Fix your SP and not the report since it is your data which is missing the information. Using SQL Server BOL, search for CROSS TAB REPORTs .

  3. #3

    Thread Starter
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263

    Re: How to show empty columns at crosstab ?

    ARPRINCE,

    The problem is, when I don't have values at the month, this month doesn't exist... So I have no information about this month, no value and no month...

    As I said before...

    I think this solution doesn't apply for my problem...

    []s

    João Luiz
    Last edited by Jlarini; Oct 19th, 2006 at 02:39 PM.
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  4. #4
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Re: How to show empty columns at crosstab ?

    Here's a more "CONVINCING" example. The middle part is the data. You could see that you have missing MONTHS for both groups 1 and 2.

    The last part is the result when running the SQL statement (first part).

    HTH
    Attached Images Attached Images  

  5. #5

    Thread Starter
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263

    Re: How to show empty columns at crosstab ?

    I didn't try it yet, but by reading, it looks fine...

    I'll try it and let you know the results!

    thanks!

    João Luiz

    In time...

    Do you have any clue about this ?

    http://www.vbforums.com/showthread.php?t=432267
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  6. #6

    Thread Starter
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263

    Re: How to show empty columns at crosstab ?

    ARPRINCE,

    Now I have the same problem, but, a little different...

    I have four fields... (see attach...)

    Example of the result I need:

    VB Code:
    1. Group: 1
    2.  
    3.       Jan    Feb    Mar   Apr .... and so on... With 0 as I have no values for these months...
    4.  a   100      0       10     0
    5.  b     22      0     121     0
    6.  c     22      0     212     0
    7.  d     15      0       22     0
    8.  
    9. Group: 2
    10.  
    11.       Jan    Feb    Mar   Apr .... and so on... With "0" as I have no values for these months...
    12.  a      0      5     121    12
    13.  b      0     57      12    21
    14.  c      0     74      21    22
    15.  d      0      7     111    22

    Important: I'm using SQL Server's Stored Procedure...

    Tks,

    João Luiz
    Attached Images Attached Images  
    Last edited by Jlarini; Oct 20th, 2006 at 06:32 AM.
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  7. #7

    Thread Starter
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263

    Re: How to show empty columns at crosstab ?

    Well,

    It's resolved, by myself, after a lot of work...

    Just made changes in SPs...

    []s

    João Luiz
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width