SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic column crystal report.

    Dear All,
    I am developing a C# application. So for my crystal report I need to choose a paper size. The problem here is that I want my data column which to appear on my report to be dynamic and I want them to appear dynamically. But due to the paper size restriction I cant go further is there any solution? Thank you.

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More like you having a issue placing the column in your report, can you attach a partial screenshot of your report to see what you trying to do?

  3. #3
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lyph,
    My requirement is simple just say I got a list of employee. So my column will be each employee name and row will be employee sales data. So when in my C# application I am crystal report to show my report. So in this case when I select a particular paper size it becomes a stopping point for me. How can I overcome this problem ?

  4. #4
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have say 3 different paper sizes for printing, I would create 3 different crystal reports and dynamically load the crystal report base on paper selection.

  5. #5
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lyn,
    So mean that you want my user to select the report based on the paper size options is it. The paper size is also depend on the printer I select. Meaning that in windows application based the paper size is a constraint unlike web based the column is not limited rite? Thank you.

  6. #6
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, if you creating the report for website for viewing only, then you can create any size. Only thing you have to consider is when its come to printing.

  7. #7
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    The problem here I am creating a windows application based on C#. So I am not creating a web base application that is the problem here. So what is the best solution you will suggest for my scenario? I also want the column to appear dynamically meaning that I will have an option say I got 10 employee. I select 5 then only 5 column should appear. How can I do this for crystal report for windows application.

  8. #8
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am little confused about the design you talking about, usually variation parameter should be consider as Rows, Columns should be fixed.

    Cannt you change the way you create your report, if you getting varying number of employees, i think its better to design that it should fall as Rows

    For example
    Code:
    Name                 Hours Worked     Hourly Pay            Total
    Employee1                         35          $17.00          $595.00
    Employee1                         42          $18.00          $756.00
    ....
    Like over here, you can change any number of employees but the coulms are fixed.

  9. #9
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    Sorry for the confusion here. Ok my design will be like this. Each date will show the total sales made by each employee. So any suggestion you have or any idea to solve my problem. Thank you.

    Date Employee1 Employee2 Employee3

    12/1/09 $200 $500 $600
    13/1/09 $560 $400 $700

  10. #10
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to change the way you design your crystal report

    If you want to get the total sales for for each day, group by your query with date and show something like this

    Code:
    Date - 10/Apr/2009
                                         Sales
    Employee 1                      $500
    Employee 2                      $550
    Employee 3                      $600
    ...
                                       ------
    Sub Total                        $xxxx
    
    Date - 12/Apr/2009
                                         Sales
    Employee 1                      $450
    Employee 2                     $650
    Employee 3                      $550
    ...
                                       ------
    Sub Total                        $xxxx
    
    ....
    
    (footer)Gran Total            $xxxxx

    If you want to get the total sales for for employee, group by your query with employee and show something like this

    Code:
    Employee - Employee 1
                                         Sales
    10/Apr/2009                     $500
    11/Apr/2009                     $550
    12/Apr/2009                     $600
    ...
                                       ------
    Sub Total                        $xxxx
    
    Employee - Employee 2
                                         Sales
    10/Apr/2009                     $500
    11/Apr/2009                     $550
    12/Apr/2009                     $600
    ...
                                       ------
    Sub Total                        $xxxx
    
    ....
    
    (footer)Gran Total            $xxxxx

  11. #11
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    Thank you for your idea. Yes I agree your method is good the problem is that if I maintain as my earlier method it gives a me clearer view when I need to compare each employee against each day I mean the tabular format. Thank you.

  12. #12
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think the way basic crystal report design is to keep the columns fixed and maintain rows according to the query. If you want dynamically change number of columns and data at runtime, check this project

    http://www.codeproject.com/KB/cs/Dyn...al_Report.aspx

    I would consider generating a Excel work sheet using C# for your case, its much easier.

  13. #13
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    Yes the excel idea will be great too. Can you teach me how to generate an excel sheet then? Thank you.

  14. #14
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are many ways to do that, I think easiest way is to generate a regular text base HTML string and save it with Excel file extension (.xls)

    Example
    Code HTML4Strict:
    <table width="100%" border="0" cellspacing="3" cellpadding="3">
      <tr>
        <td align="center"><strong>Date</strong></td>
        <td align="center"><strong>Employee 1</strong></td>
        <td align="center"><strong>Employee 2</strong></td>
        <td align="center"><strong>Employee 3</strong></td>
        <td align="center"><strong>Employee 4</strong></td>
      </tr>
      <tr>
        <td>10-Apr-2009</td>
        <td>$500</td>
        <td>$550</td>
        <td>$450</td>
        <td>$650</td>
      </tr>
      <tr>
        <td>11-Apr-2009</td>
        <td>$450</td>
        <td>$600</td>
        <td>$500</td>
        <td>$600</td>
      </tr>
      <tr>
        <td>12-Apr-2009</td>
        <td>$650</td>
        <td>$400</td>
        <td>$650</td>
        <td>$400</td>
      </tr>
    </table>

    You can generate above HTML string using C# and then save it as a text file with Excel extension. Then you can open it from Excel

  15. #15
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    I am working on a windows application and not web base application. So I dont think so I can run html codes rite? Thank you.

  16. #16
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can, you can generate any kind of data and save it to disk, it doesnt matter you doing a Desktop application or ASP .Net. Both use the similar method

  17. #17
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    So how will I generate from my C# code an excel document then off course I need to build the columns and rows too right ? Thank you.

  18. #18
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found this article in Google
    Export Sql Table to Excel for Windows Application
    http://www.dotnetspider.com/resource...plication.aspx

    Search in google, you will able to find lot of example generating EXcel in C#

  19. #19
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    Thank you very much for your time. I will look further and incase I got stuck then will get back to you.

  20. #20
    SitePoint Zealot
    Join Date
    Apr 2009
    Location
    South Florida
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is another tool might help you to play with dynamic data with crystal report
    http://www.digitalcoding.com/free-so...view-tool.html

  21. #21
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Lphy,
    Actually have you used this tool. I am a bit confuse what this tool will be doing? Able to generate report is it? Thx.


Bookmarks

Posting Permissions

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