connection to multiple dataset used by the same report

  • lari3008 6 days, 1 hour ago

    Hi all ,
    I am currently learning how to use activereport 11 . I have come across an issue. I have created a basic report which uses object provider and a as its source of data as

    public myAlacerReport(string title_header, int Av_price, int qty, double C_year, double margin, double margin_per, string title_list, string title_footer)
    {
    this.title_header = title_header;
    this.Av_price = Av_price;
    this.qty = qty;
    this.C_year = C_year;
    this.margin = margin;
    this.margin_per = margin_per;
    this.title_list = title_list;
    this.title_footer = title_footer;

    }

    public static List GetData()
    {

    List FReport = new List();

    FReport.Add(new myAlacerReport(“Bar”, 12, 1, 2.0, 10.43, 5.59, “pan Seared Tuna”, “Bar Total”));
    FReport.Add(new myAlacerReport(“Bar”, 12, 1, 2.0, 10.43, 5.59, “Budwieser(bottle)”, “Bar Total”));
    FReport.Add(new myAlacerReport(“Champagne”, 12, 1, 2.0, 10.43, 5.59, “bollinger Grande”, “champagne Total”));
    FReport.Add(new myAlacerReport(“Champagne”, 12, 6, 4.0, 254.35, 11.67, “pan and Blue Cheese”, “champagne Total”));
    FReport.Add(new myAlacerReport(“Champagne”, 5, 2, 174.78, 31.07, 71.2, “Table Dhote”, “champagne Total”));
    FReport.Add(new myAlacerReport(“Food”, 9, 8, 6.0, 44.5, 88.77, “Goats Cheese Crouton”, “Food Total”));
    FReport.Add(new myAlacerReport(“Food”, 35, 10, 23.8, 48.5, 14.32, “Hot Smoked salmon”, “Food Total”));

    return FReport;
    }

    private void Document_LocateDataSource(object sender, LocateDataSourceEventArgs args)
    {
    List data = myAlacerReport.GetData();
    args.Data = data;
    }

    i then created a report handler

    PageReport rptRdl = new PageReport(new FileInfo(Server.MapPath(“Reports/testReports/test1report.rdlx”)));
    rptRdl.Document.LocateDataSource += Document_LocateDataSource;

    return rptRdl;

    the code works fine but i wanted to connect myself to two or more list at the same time and used in the same report. Please see below my second list.

    public static List GetList()
    {
    List
    customers = new List();

    customers.Add(new myCustomer(“lari”, 4, “london”, “Female”));
    customers.Add(new myCustomer(“xx”, 5, “cambridge”, “Female”));
    customers.Add(new myCustomer(“py”, 6, “bourne”, “Female”));
    customers.Add(new myCustomer(“Ldsd”, 7, “test”, “Female”));
    customers.Add(new myCustomer(“Ch”, 8, “manchester”, “male”));

    return customers;
    }

    Anyone can help please thanks

  • 189p
    AbdiasM189p 4 days, 5 hours ago

    Hi,

    You can easily display data from two lists in the same report by creating two DataSets and binding them to two Tables (or any other Data control) in an RDL report. I have attached a sample application which implements this using the code below:

    private void Document_LocateDataSource(object sender, LocateDataSourceEventArgs args)
            {
                if (args.DataSetName == “DataSet1″)
                {
                    var response = client.GetAsync(url);
                    var deserializer = new JavaScriptSerializer();
                    List<customer> data = deserializer.Deserialize(response.Result.Content.ReadAsStringAsync().Result, typeof(List</customer><customer>)) as List</customer><customer>;
    
                    args.Data = data;
                }
                else if (args.DataSetName == “DataSet2″)
                {
                    var response = client.GetAsync(url2);
                    var deserializer = new JavaScriptSerializer();
                    List<movie> moviedata = deserializer.Deserialize(response.Result.Content.ReadAsStringAsync().Result, typeof(List</movie><movie>)) as List</movie><movie>;
    
                    args.Data = moviedata;
                }
            }

    Hope the sample helps clarify.

  • lari3008 4 days, 4 hours ago

    Hi AbdiasM ,

    thanks that rely helped its working fine now.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.