Crystal Reports.doc

download Crystal Reports.doc

of 41

Transcript of Crystal Reports.doc

  • 8/14/2019 Crystal Reports.doc

    1/41

    Introduction

    I was searching the internet for Crystalreportsin 2010and I found in 2005, but was notable to find any particular tutorials for 2010. So I thought, let me take a chance to write it

    for some beginners like me who have not worked onCrystalReportsearlier.

    In this article, I will show you simple report creation process with screenshots. A picture

    is worth more than a thousand words, so I always believe in an article with screenshots.

    et!s start by creating a new website in "S2010. See the following screen#

    Figure 1

    As per figure $, create a new website in "S2010and name it as per your choice. %ow let

    me show you the database table structure.

  • 8/14/2019 Crystal Reports.doc

    2/41

    Figure 2

    &he above figure shows the db table structure. And the below figure 'Figure 3) will show

    you some sample data in the table#

    Figure 3

    If you want to run this sample pro(ect directly, then you can download the database script

    from the link at the top.

    %ow we have to create an )sd file as a blank data source as we are going to use strong data

    type. *ere I will divide this tutorial in 5 sub sections as mentioned below#

    Simple report using CrystalReporting Tool

    Group report

    Chart report

    Sub report

    Cross tab report

  • 8/14/2019 Crystal Reports.doc

    3/41

    Simple Report using Crystal Report

    &he below figure shows you the process to create an +S file.

    -or adding an +S file, click on Solution )plorer / 1ight lick on 3ro(ect / click on Add

    new Item and then it will show you the below screen.

    Figure 4

    lick on the ok button, so it will ask for confirmation to put that file inApp_Codefolder. 4ustclick ok and that file will open in the screen as a blank screen.

    %ow we will add one blank datatable to that +Sfile. 4ust right click on the file andselect Add -> Datatale. It will add one DataTable1 to the screen. -igure 5 shows how

    to add datatable to +S file.

  • 8/14/2019 Crystal Reports.doc

    4/41

    Figure 5

    %ow datatable1 is added to +S file. %ow we will add data column to

    the datatable1 as per figure . 1emember whatever fields 'columns6 we add here, it will

    be available to show on the report. So add column which you want to display inyour reportsone by one here.

  • 8/14/2019 Crystal Reports.doc

    5/41

    Figure 6

    1emember to give the e)act same name for data column as in database and also select

    data type which is the same as database, otherwise you will get an error for field and datatype mismatch.

    7nce we add all the re8uired columns in datatable, then set property forthe datacolumn as it has in database. &he below figure will show you how to set property

    for data columns. efault datatype for all the columns is string here so if datatype is

    other than string then only change it manually.

    4ust right click on thedatacolumn

    indatatable

    and select property and from property

    window, select appropriate datatype from DataType Dropdown for that datacolumn.

  • 8/14/2019 Crystal Reports.doc

    6/41

    Figure 7

    &hat!s it. +S file creation has been done. %ow we will move to create Crystalreport

    design.

    4ust click on the Solution )plorer / 1ight click on the pro(ect name and

    select crystalreports. %ame it as per your choice and hit the add button.

    -igure 9 will show you the creation process of Crystalreports.

  • 8/14/2019 Crystal Reports.doc

    7/41

    Figure 8

    lick on the add button and one .rptfile will be added to the solution. And also, it will ask

    for the report creation type of how you want to create the report. -igure : will show you ascreenshot.

  • 8/14/2019 Crystal Reports.doc

    8/41

    Figure 9

    4ust click ok button to proceed. It will lead you to figure $0#

  • 8/14/2019 Crystal Reports.doc

    9/41

    Figure 10

    ;nder pro(ect data, e)pand AD!"#$% Datasets and select DataTable1 and add to the

    selected table portion located at the right side of the windows using >button.

    %ow click on the -inish button and it will show the ne)t screen '-igure $$6#

  • 8/14/2019 Crystal Reports.doc

    10/41

    Figure 11

    7nce report file is added, you can see Field $&ploreron the left side near server e)plorer.

    )pand Dataase Fields,under that you will be able to find atatable that we havecreated earlier. 4ust e)pand it and drag one by one filed from -ield )plorer to the rpt file

    under detail section"

    %ow the report design part is over. %ow we have to fetch the data from database and bind

    it to dataset and then bind that dataset to the report viewer.

    et!s go step by step.

    -irst rag a CrystalReportViewer control on asp) page from tool bo) as per below

    screen#

  • 8/14/2019 Crystal Reports.doc

    11/41

    Figure 12

    %ow we will fetch the data, pass data to the dataset and then add that dataset tothe Crystal1eport. opy ode

    usingCrystalDecisions.CrystalReports.Engine;usingCrystalDecisions.Shared;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Coniguration;

    opy ode

    protected!oid"age#$oad%ob&ectsender' E!ent(rgs e)* ReportDocument rptDoc + newReportDocument%); dsSample ds + newdsSample%); // .xsd file name DataTable dt + newDataTable%);

    // Just set the name of data table dt.Table,ame + -CrystalReport Example-; dt + get(llrders%); //This function is located below this function ds.Tables/0.2erge%dt);

    // Your .rpt file path will be below rptDoc.$oad%Ser!er.2ap"ath%-..3Reports3SimpleReports.rpt-));

    //set dataset to the report viewer. rptDoc.SetDataSource%ds); CrystalReportViewer1.ReportSource + rptDoc;4

    http://www.codeproject.com/Articles/166291/Generate-a-report-using-Crystal-Reports-in-Visualhttp://www.codeproject.com/Articles/166291/Generate-a-report-using-Crystal-Reports-in-Visualhttp://www.codeproject.com/Articles/166291/Generate-a-report-using-Crystal-Reports-in-Visualhttp://www.codeproject.com/Articles/166291/Generate-a-report-using-Crystal-Reports-in-Visual
  • 8/14/2019 Crystal Reports.doc

    12/41

    publicDataTable get(llrders%)* //Connection string replace 'databaseservername' with your db server name string sqlCon + -5ser 6D+sa;"7D+sa; ser!er+databaseser!ername;6,6T6($C(T($8+SampleD9;-: -"ERS6STSEC5R6T 6,

  • 8/14/2019 Crystal Reports.doc

    13/41

    Figure 13

    'rouping in Crystal Report

    *ere we will see only report design and rest of the things, you can refer from Section 1.

    *ere we will groupCustomer, "roduct, rder and ?uantity. -or details, (ust go through

    -igure $?.

    4ust add a report '.rpt6 file to the solution. Select the appropriate dataset from popup

    window. 7nce it!s done, then select grouping option like figure $?.

  • 8/14/2019 Crystal Reports.doc

    14/41

    Figure 14

    %ow, right click on the report, select Report -> 'roup $&pertsand the resulting window

    will look like figure $5#

    Figure 15

  • 8/14/2019 Crystal Reports.doc

    15/41

    %ow we want to group like Customer #ameand (roduct nameso first add Customer to

    the right 3anel. &hen move product name to the right panel like figure $#

    Figure 16

    &his time Crystalreport design will be different than the previous time. See figure $@.

    8roup@eaderSection1 and 8roup@eaderSectionA are added to the report designer.*ere roup =$ %ame refers to ustomer %ame and roup =2 %ame refers to 3roduct

    %ame.

    And also 8roup

  • 8/14/2019 Crystal Reports.doc

    16/41

    Figure 17

    %ow under every group, we want to show the number of orders per customer and

    productwise, so for that, we have to add summary to the 8roup

  • 8/14/2019 Crystal Reports.doc

    17/41

    Figure 18

    1ight lick on the 8roup Summary" It will show you the

    ne)t screen '-igure $:6. And I have also added Order_IDand Product_Qtyfield to the

    detail 'section B6 part.

  • 8/14/2019 Crystal Reports.doc

    18/41

    Figure 19

    In summary window, select the column which you want to summariCe in the first dropdown.

    Select Sum '-irst option6 from the calculate drop down.

    Summary ocation is already set to the report footer. So (ust click ok to place that summaryfield to the report.

  • 8/14/2019 Crystal Reports.doc

    19/41

    Figure 20

    %ow save the report and run it finally. It looks like figure 2$.

  • 8/14/2019 Crystal Reports.doc

    20/41

    Figure 21

    Cart in Crystal Report

    hart is the most important and visible part of the reporting tool. Crystalhas very powerful

    feature to add chart in report. et!s see how to add chart in 1. *ere also, we will see only

    designing of the chart for other thing. 3lease refer to Section 1.

    *ere we will show customer wise product ordered 8uantity in chart. + portion willdisplay Customer name and F portion will display customers total ordered 8uantity.

    -irst add charts to the report design.

    1ight click on the .rptfile and select Insert->Cart. 1efer to figure 22.

    Figure 22

    7nce you add chart to the report, it will not show chart on the report file but with mousepointer you can see one blank rectangle is moving. So (ust click on the 1eport header. It will

    open popup for chart style and other options. 1efer to figure 2B.

  • 8/14/2019 Crystal Reports.doc

    21/41

    Figure 23

    %ow from type tab, select type of the charts like bar chart, line chart, pie chart, etc. form

    the left side. Select sub type from the right pane like side y side cart, percentage arcart, etc. I am not going into the detail of it. I am leaving it for you to practice work.

    And also select vertical or horiContal radio button from the below section if you want tochange the chart style vertically or horiContally. heck *se dept e++ectcheck bo) if you

    need shadow effect on the graph. 1efer to figure 2B.

  • 8/14/2019 Crystal Reports.doc

    22/41

    Figure 24

    As per figure 2?, move to the ne)t tab data. &here are three bo)es, available fields, onchange of and show values. So move ustomer %ame from available fields to on changes of

    bo), and move 3roduct Euantity filed to the show value bo) and click ok.

    %ow you can see chart is added to the report header section as per figure 25.

  • 8/14/2019 Crystal Reports.doc

    23/41

    Figure 25

    %ow, (ust save the report and run it. Fou can see a 1eport as a chart on the screen.

    Report Inside Report ,Su Report)

    Crystalreportsprovide reportsinside report feature which are normally known as a

    subreport feature.

    et me e)plain it in detail. *ere also, we will design only sub report design. -or rest of thethings, refer to Section 1.

    Add new report to the solution. &hen add Report->'roup and select only Customer name

    because we want to design report for each customer and sub report product wise. So

    there will be only one group header inside theCustomergroup header as per figure 2.

  • 8/14/2019 Crystal Reports.doc

    24/41

    Figure 26

    %ow right click on etail section and select Insert->Sureport" 1efer to figure 2@.

  • 8/14/2019 Crystal Reports.doc

    25/41

    Figure 27

    7nce we add subreport, it will show screen like figure 29.

  • 8/14/2019 Crystal Reports.doc

    26/41

    Figure 28

    As per figure 29, by default, choose a Crystal Report in projectis selected if you want toadd report from the pro(ect, then otherwise select create a subreport ith the report

    i!ar"# 7nce we select createa subreport with 1eport DiCard 'Brdradio button6, we haveto click on the 1eport DiCard button to select report type and data source (ust do as (art -

    1first. &hen click on ok button so like chart report it will show a moving rectangle aroundmouse, click on the detail section where you want to show subreport.

    %ow to edit the sub report, refer to figure 2:.

  • 8/14/2019 Crystal Reports.doc

    27/41

    Figure 29

    lick on the edit subreport option and format the report as per your need. *ere I willsuggest add product name and product 8uantity or you can add chart also for sub report.

    Dhen you click on the subreport button, it will open subreport designer, actually 1 willcreate a separate .rptfile but it will remain hidden inside the main .rptfile so we can!t see

    it..

    %ow run the report and you can see the result, report inside report like figure B0.

  • 8/14/2019 Crystal Reports.doc

    28/41

    Figure 30

    *ere number $ is the main report and number 2 is the subreport it!s showing title as

    3roduct wise.

    Cross %a Report in Crystal Report

    -irst, let me make it clear as to what is a ross tab report. %ormally, we generate reportrow wise like first we show customer name, then product wise, etc.

  • 8/14/2019 Crystal Reports.doc

    29/41

    Figure 31

    *ere also, I will show how to design cross tab report only, for rest of the things, refer

    to Section 1.

    -irst add .rptfile to the solution. &hen add cross report to the 1eport *eader section as per

    the below figure '1efer to figure B26.

    1emember we can add cross tab report only in 1eport header or report footer section.

  • 8/14/2019 Crystal Reports.doc

    30/41

    Figure 32

    7nce we click on cross tab report options, it will show moving rectangle around mouse

    pointer (ust place it to the report header section.

    As we click on header section, it will lead to the figure BB.

    Figure 33

    As per the figure, move Customer name field to the 1ows section, "roduct name we

    want to show as a olumn so move it to the olumns fields, and we want to

    show product total so move it to the summariCed fields. &hat!s it. 4ust run the report and

    you can see the output as shown in figure B$.

    It!s as simple as that. If you have any 8ueries regarding any type of the abovementioned reports, please let me know by way of comments. I will try my level best to

    fulfill your re8uest.

    et!s en(oy reportingG

    Article Source# ot%et Stuff

    http://myvsdotnetstuff.blogspot.com/2011/03/generate-report-using-crystal-reports.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/generate-report-using-crystal-reports.html
  • 8/14/2019 Crystal Reports.doc

    31/41

    Grouping

    Here we will see only report design and rest of things you can refer from the Tutorial part - 1.

    Here we will group CustomerProductOrder and Quantity.

    For details just go through figure 14.

    Just add a report.rpt! file to the solution. "elect the appropriate dataset from popup window.Once it#s done then select grouping option li$e figure 14.

    Figure 14

    %ow right clic$ on the report select Report Group Expertsand

    &esulting window will loo$ li$e figure 1'

    Figure 15

    %ow we want to group li$e Customer Nameand Product nameso first add Customer to the right Panel.

    (hen mo)e product name to the right panel li$e figure 1*

    Figure 16

    http://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttps://lh6.googleusercontent.com/-147oON82k60/TXIfn3o08hI/AAAAAAAAADc/_ZUqb2Y6-gY/s1600/Figure+16.jpghttps://lh6.googleusercontent.com/-bIBpdQAzatM/TXIfjMZzsVI/AAAAAAAAADY/5GWjQo4_xGA/s1600/Figure+15.jpghttps://lh4.googleusercontent.com/-sG9sQv7GfOE/TXIffHwJWYI/AAAAAAAAADU/EE7HMCATDvc/s1600/Figure+14.jpghttp://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.html
  • 8/14/2019 Crystal Reports.doc

    32/41

    (his time crystal report design will +e different than pre)ious time. "ee figure 1,

    -roupHeader"ection1 and -roupHeader"ection are added to the report designer. Here -oup /1 %ame

    refers Customer %ame and -roup / %ame refer Product %ame

    0nd also -roupFooter"ection1 and -roupFooter"ection is added +elow if you want to add something to

    group footer.

    Figure 17

    %ow under e)ery group we want to show the num+er of order per customer and product wise so for that

    we ha)e to add summary to the -roupFooter"ection. &efer Figure 1

    Figure 1

    &ight Clic$ on the -roupFooter"ection select !nsert"ummar#$ 2t will so you ne3t screen Figure 1!.0nd 2 ha)e also added %rder&!'and Product&(t#field to the detail section5! part.

    https://lh6.googleusercontent.com/-BMl0qYrHnoo/TXIf0ywc93I/AAAAAAAAADo/agVV9vrmPPc/s1600/Figure+19.jpghttps://lh3.googleusercontent.com/-BM_K1N4Y-Kg/TXIfv0cVQ4I/AAAAAAAAADk/xEYxWz1zQbU/s1600/Figure+18.jpghttps://lh5.googleusercontent.com/-m8ul5dL_c3M/TXIfrnrgLVI/AAAAAAAAADg/UXjECFMrVh4/s1600/Figure+17.jpg
  • 8/14/2019 Crystal Reports.doc

    33/41

    Figure 1)

    2n summary window select the column which you want to summarise in first dropdown.

    "elect "um First option! from the calculate drop down.

    "ummary 6ocation is already set to the report footer. "o just clic$ o$ to place that summary field to

    the report.

    7y default "ummary field is added to the &eport Footer section so mo)e it to the groupFooter"ection if

    you want to group product wise8 mo)e it to the -roupFooter"ection1 if you want to group Customer 9iseor $eep it at original place if you want to sum all ordered product. 2 ha)e mo)e to the Footer"ection1 so it

    will show Customer 9ise (otal Quantity. &efer Figure :

    Figure *+

    %ow sa)e the report and run it finally it loo$s li$e figure 1

    Figure *1

    Other post for this tutorials

    1. Simple report using Crystal Reporting Tool.2. Group report.(Current)3. Chart report.4. Sub report.5. Cross tab report.

    http://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-chart-in-crystal-reports-tutorial.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-chart-in-crystal-reports-tutorial.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-report-inside-reports-tutorial-part.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-report-inside-reports-tutorial-part.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-report-inside-reports-tutorial-part.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-report-inside-reports-tutorial-part.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttps://lh3.googleusercontent.com/-30xsSujju6k/TXIf8x4RRoI/AAAAAAAAADw/RQAkp-kjXH4/s1600/Figure+21.jpghttps://lh4.googleusercontent.com/-GdVYM9c_2Gk/TXIf4r2_UVI/AAAAAAAAADs/O-ZLweW42EU/s1600/Figure+20.jpghttp://www.blogger.com/goog_1713418468http://myvsdotnetstuff.blogspot.com/2011/03/simple-report-using-crystal-reporting.htmlhttp://www.blogger.com/goog_1975473747http://www.blogger.com/goog_1198172794http://myvsdotnetstuff.blogspot.com/2011/03/add-chart-in-crystal-reports-tutorial.htmlhttp://www.blogger.com/goog_1198172790http://myvsdotnetstuff.blogspot.com/2011/03/add-report-inside-reports-tutorial-part.htmlhttp://www.blogger.com/goog_1198172785http://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.html
  • 8/14/2019 Crystal Reports.doc

    34/41

    2t#s as simple as that. 2f you ha)e any ;uery regarding any type of a+o)e mentioned report just let me

    $now +y comment 2 will try my le)el +est to fulfil your re;uest.

    6et#s enjoy reporting...................

    No, ,e ,ill etc. t.e data/ pass data to t.e dataset and t.en add t.atdataset to t.e Cr#stal Report$0elo, is t.e C Code ,.ic. ,ill do t.e 2o3

    using Crystal

    using Crystal

    using "ystem.Configuration>

    7elow is the final code for reports.

    protected )oid Page?6oado+ject sender8 =)ent0rgs e!

    @&eport BB(his function is located +elow this function

    ds.(a+lesD:E.ergedt!>

    BB Gour .rpt file path will +e +elow

    rpt

    BBset dataset to the report )iewer.

    rpt

    Crystal&eportiewer1.&eport"ource A rptI

    pu+lic 2%2(206

    C0(06O-A"ampleP=&"2"( "=CK&2(G 2%FOAF06"=>Connect (imeoutA:>

    ";lConnection Con A new ";lConnections;lCon!>

    ";lCommand cmd A new ";lCommand!>

    BB"tored procedure calling. 2t is already in sample d+.

    cmd.Command(e3t A get0llOrders>

    cmd.Command(ype A Command(ype."toredProcedure>

    cmd.Connection A Con>

    ds A new

  • 8/14/2019 Crystal Reports.doc

    35/41

    I

    catch =3ception e3!

    @

    throw new =3ceptione3.essage!>

    I

    finally

    @cmd.

    if Con."tate LA Connection"tate.Closed!

    Con.Close!>

    I

    return ds.(a+lesD:E>

    I

    Using Charts in Crystal Reports

    Chart is the most important and )isi+le part of the reporting tool. Crystal has )ery powerful feature to add

    chart inreport. 6et#s see how to add chart in C&. Here also we will see only designing of the chart for otherthing please refers PartM1.

    Here we will show customer wise product ordered ;uantity in chart. N portion will display Customer name

    and G portion will display customers total ordered ;uantity.

    First add charts to the report design.

    &ight clic$ on the .rpt file and select !nsertC.artrefer figure

    Figure **

    Once you add chart to the report it will not show chat on the report file +ut with mouse pointer you can

    see one +lan$ rectangle is mo)ing. "o just clic$ on the &eport header it will open popup for chart style

    and other options. &efer figure 5

    http://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttps://lh6.googleusercontent.com/-moprb3aHtEs/TXIwQSmCZgI/AAAAAAAAAD0/3-1SPN1O9fE/s1600/Figure+22.jpghttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.html
  • 8/14/2019 Crystal Reports.doc

    36/41

    Figure *

    %ow from type ta+ select type of the charts li$e +ar chart8 line chart8 part chart etc form the left side.

    "elect su+ type from the right pane li$e side 3# side c.art/ percentage 3ar c.artetc 2 am not going to

    the detail of it. 2 am lea)ing it for you to practice wor$.0nd also select )ertical or horiontal radio +utton from the +elow section if you want to change the

    chart style )ertically or horiontally. Chec$ se dept. eectchec$ +o3 if you need shadow effect on the

    graph. &efer figure 5

    Figure *4

    0s per figure 4 mo)e to the ne3t ta+ data there are three +o3es8 a)aila+le fields8 on change of and show

    )alues. "o mo)e Customer %ame from a)aila+le fields to on changes of +o38 and mo)e Product Quantity

    filed to the show )alue +o3 and clic$ o$.

    %ow you can see chart is added to the report header section as per figure '

    https://lh4.googleusercontent.com/-Ryqqcf5kyJk/TXIwYx32MJI/AAAAAAAAAD8/3ifjj0wWUiw/s1600/Figure+24.jpghttps://lh5.googleusercontent.com/-4bbGQa0MGKo/TXIwU9erOUI/AAAAAAAAAD4/pP-dwPoRslc/s1600/Figure+23.jpg
  • 8/14/2019 Crystal Reports.doc

    37/41

    Figure *5

    %ow just sa)e the report and run it you can see a &eport as a chart on the screen.

    Report inside Report

    Crystal reports pro)ide reports inside report feature which normally $nown as a su+report feature.

    6et me e3plain it in details. Here also we will design only su+ report design for rest of the thing referpart-

    1

    0dd new report to the solution. (hen add ReportGroup and select only Customer name +ecause wewant to design report for each customer and su+ report product wise. "o there will +e only one group

    header inside the Customergroup header as per figure *.

    Figure *6

    %ow right clic$ on

  • 8/14/2019 Crystal Reports.doc

    38/41

    Figure *7

    Once we add su+report it will show screen li$e figure

    Figure *

    0s per figure +y default choose a Crystal Report in projectis selected if you want to add report from

    the project then otherwise select create a subreport with the report wizard. Once we select createasu+report with&eport 9iard 5rdradio +utton! we ha)e to clic$ on the &eport 9iard +utton to

    select report type and data source just do as Part - 1first. (hen clic$ on o$ +utton so li$e chart report it

    will show a mo)ing rectangle around mouse 8 clic$ on the detail section where you want to show

    su+report.

    %ow to edit the su+ report refer figure

    https://lh3.googleusercontent.com/-dG64JAxVIZs/TXIy-_Y54hI/AAAAAAAAAEM/tZFVZlEsMIA/s1600/Figure+28.jpghttps://lh4.googleusercontent.com/-ez17wZq5TSY/TXIy6Q-8RkI/AAAAAAAAAEI/xf8LML_eQCI/s1600/Figure+27.jpg
  • 8/14/2019 Crystal Reports.doc

    39/41

    Figure *)

    Clic$ on the edit su+report option and format the report as per your need here 2 will suggest add product

    name and product ;uantity or you can add chart also for su+ report. 9hen you clic$ on the su+report

    +utton it will open su+report designer8 actually C& will create a separate .rpt file +ut it will +e remain

    hidden inside the main .rpt file so we can#t see it.

    %ow run the report and you can see the result8 &eport inside report li$e figure 5:

    Figure +

    Here no 1 is the main report and no is su+report it#s showing title as Product wise.

    Add CrossTab Report in Crystal Report

    First let me ma$e you clear what is Cross ta+ report. %ormally we are generating report row wise li$e first

    we show customer name then product wise etc. 7ut suppose we want to see report as a

    column wise li$e product name should +e display as column in report then cross ta+ report come into

    picture. "ee result of Cross (a+report in figure 51

    https://lh6.googleusercontent.com/-M63k1Sy2GnQ/TXIzIbUGtmI/AAAAAAAAAEU/0KcR_B-E7AM/s1600/Figure+30.jpghttps://lh4.googleusercontent.com/-9XSuVXnsAn4/TXIzDcrQb2I/AAAAAAAAAEQ/R7v5nlE1DCg/s1600/Figure+29.jpg
  • 8/14/2019 Crystal Reports.doc

    40/41

    Figure 1

    Here also 2 will show how to design cross ta+ report only8 for rest of the thing refer Part-1.

    First add .rpt file to the solution. (hen add cross report to the &eport Header section as per +elow figure

    &efer figure 5!

    &emem+er we can add cross ta+ report only in &eport header or report footer section.

    Figure *

    Once we clic$ on cross ta+ report options it will show mo)ing rectangle around mouse pointer just place it

    to thereport header section.

    0s we clic$ on header section it will lead to the figure 55

    http://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.htmlhttps://lh4.googleusercontent.com/-wwzKE0kJg0I/TXI2U6c6cyI/AAAAAAAAAEg/C_ragLpamAM/s1600/Figure+33.jpghttps://lh5.googleusercontent.com/-CCi7MTf646M/TXI2RwNz5kI/AAAAAAAAAEc/1KFyniFpV70/s1600/Figure+32.jpghttps://lh3.googleusercontent.com/-67_ay_ExGcs/TXI2OHzIP7I/AAAAAAAAAEY/h-iUxklMbyA/s1600/Figure+31.jpghttp://myvsdotnetstuff.blogspot.com/2011/03/add-cross-tab-report-in-crystal-reports.html
  • 8/14/2019 Crystal Reports.doc

    41/41

    Figure

    0s per figure mo)e Customer name field to the &ows section8 Product name we want to show as a

    Column so mo)e it to the Columns fields8 and we want to show product total so mo)e it to the

    summaried fields. (hat#s it.Just run the report and you can see the output as figure 51.