Click here to Skip to main content
15,860,861 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
Hi
i have a xml data like this

XML
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <supplier>
    <s_code>1</s_code>
    <net_weight>100</net_weight>
    <rate>100.00</rate>

    <items>
      <s_code>1</s_code>
      <item_code>SKU001</items_code>
      <price>100</price>
    </items>
    <items>
      <s_code>1</s_code>
      <item_code>SKU002</items_code>
      <price>200</price>
    </items>

  </supplier>

  <supplier>
    <s_code>2</s_code>
    <net_weight>500</net_weight>
    <rate>150.00</rate>

    <items>
      <s_code>2</s_code>
      <item_code>SKU001</items_code>
      <price>100</price>
    </items>

  </supplier>

</root>

and this is what i did

1. Define a dataset and two tables inside it.
2. DataTable1 to store supplier data and DataTable2 to store items data
3. created nested relation between DataTable1 s_code and DataTable2 s_code
4. created a crystal report with dataset and added s_code,net_weight to header section and
item_code,price into details section.
5. then i right click on crystal report and selected Report->Selection Expert and set Section paging tab to New page after 1 visible record

this is the code i used to load xml into two tables

C#
DataSet reportData = new DataSet();
reportData.ReadXml("http://192.168.1.10/test/data.xml");

DataSet dset = new DataSet1();
dset.Tables[0].Merge(reportData.Tables[0]);
dset.Tables[1].Merge(reportData.Tables[1]);

ReportDocument report = new CrystalReport1();
report.SetDataSource(dset);
reportViewer.ViewerCore.ReportSource = report;



now im receiving 3 pages with supplier data and items in it. but i want to display 2 pages [1 page per customer and items data relevant to each customer in each page ]


any idea what im doing wrong here? what should i do to achieve the output i needed.


Regards
Posted
Comments
gihanlasita 1-Feb-12 13:00pm    
solved problem by adding Group to DataTable1.s_code and by using the section expert to enable "New page before" for the group header

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900