Telerik Forums
Reporting Forum
13 answers
956 views
Hello,

I'm developing web app where each user have his own database, so I'm creating report datasource in code.

Example:
        Dim cnn As New OracleConnection(Session("cnnString").ToString)
        Dim sql As String = "SELECT * FROM sometable"
        Dim adapter As New OracleDataAdapter(sql, cnn)
        Dim table As New DataTable
        adapter.Fill(table)

        Dim report As New Reports.MyReport
        report.DataSource = table

That report have one subreport, but I don't know how to set subreport's datasource in code.

Thanks,

Marin Mašić
Mohamed
Top achievements
Rank 1
 answered on 29 Nov 2011
2 answers
98 views
We have a simple report, that lists people by group and gender. The report combines a table and a chart. The table appears accurately, but the chart seems to move the values around so that the values appear under different groups. You can see what I mean from the attached screen shot.

The chart is configured as follows; default type is stacked bar, xaxis.datalabelscolumn is groupname, datagroupcolumn  is gender.

The data source has three columns; groupname, gender, and a count.
ACFN    Male    1
FMFN    Female    1
FMFN468    Female    1
N-CAN    Male    1
OABO    Male    2
OCAN    Male    1
OLNA    Male    1

Both genders don't always show up in the result set for any specific group; could that be the issue?

Any and all suggestions are appreciated.
Derek
Top achievements
Rank 1
 answered on 28 Nov 2011
1 answer
110 views
I am currently trialing the Telerik reporting tool.
I have successfully created a cross tab report which is fine as long as I don't set the data source at runtime.
If I set the data source at runtime the report loses its groupings.

I have tried setting the grouping again in code but it makes no difference.
Could someone please tell me what I am doing wrong?

Cheers

Jason

Code
            OCMBusinessLogic logic = new OCMBusinessLogic();
            IList<AOSMatrix> matrixdata = null;


            matrixdata = logic.GetAOSMatrix("11/12", "ba_eng");


            MessageBox.Show("Rows " + matrixdata.Count.ToString());


            AOSModuleMatrix rpt = null;
            rpt = new AOSModuleMatrix();
            rpt.ReportParameters["ReportTitle"].Value = "Programme matrix for [programme family]";


            Telerik.Reporting.Group grp = new Telerik.Reporting.Group();
            grp.Name = "AOS";
            grp.Groupings.Add(new Telerik.Reporting.Data.Grouping("=Fields.AOScode"));
            rpt.Groups.Add(grp);
            rpt.DataSource = matrixdata;


            ReportProcessor reportProcessor = new ReportProcessor();
            Hashtable deviceinfo = new Hashtable();
            deviceinfo["FontEmbedding"] = "Subset";
            RenderingResult result = reportProcessor.RenderReport("PDF", rpt, deviceinfo);


            FileStream fs = new FileStream("c:\\telerik.pdf", FileMode.Create);
            fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
            fs.Flush();
            fs.Close();


            MessageBox.Show("Generated");

Elian
Telerik team
 answered on 28 Nov 2011
0 answers
107 views
hi!

i don't have sql server on my computer but i still want to see the source code of the demos that come with the MSI file. How can i have access to them?

I think it would be great if the demos could be installed without any instance of SQL Server! But in the meantime, is it possible to download them somewhere?

alex
Alexandre Jobin
Top achievements
Rank 1
 asked on 28 Nov 2011
1 answer
92 views
Hi !
Last time i have a query about the parameters , now i want to know about the AND and OR operator in Filters , By default there is AND operator is there when i add two or more then two parameters , can i replace that AND operator with OR operator ?
Please Reply soon:(

Best Regards

Waqas 
Steve
Telerik team
 answered on 28 Nov 2011
1 answer
196 views
We are working on MVC3 project. We can load the report viewer by using @Html.Partial("ViewPage1").
I want to know , is this possible to load the reportViewer from the template.

I tried the following code, but it doesnt work.  Any ideas?  Thanks.

<script id='downloadDeviceLightboxTemplate' type='text/x-jquery-tmpl'>

<div id='downloadADeviceLightbox'>

<form clientidmode="Static" id="frep" runat="server">

<telerik:ReportViewer ID="ReportViewer1" ToolbarVisible=true runat="server" Report="InfoSmart2.WebSite.Report.InfoSmartReportBook, InfoSmart2.WebSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

Width="100%" Height="900px">

</telerik:ReportViewer>

</form>

</div>

</

 

 

script>




Squall
Top achievements
Rank 1
 answered on 25 Nov 2011
1 answer
233 views
I want to create a dynamic report based on any data-table.  that report provides master-detail report using subreport in report viewer using csharp.
When i create a subreport using a code behind of aspx file i could not bind a subreport.


toggle action not working in dynamic report  . 

If u have a any idea about this please share your thoughts here...


Here my code:


 DataTable data = GetData().Tables[0];
            int colsCount = data.Columns.Count;
            int RowsCount = data.Rows.Count;
            Telerik.Reporting.Drawing.Unit globalRowHeight = new Telerik.Reporting.Drawing.Unit(0.28, Telerik.Reporting.Drawing.UnitType.Inch);
            Telerik.Reporting.PageHeaderSection PageHeader = new Telerik.Reporting.PageHeaderSection();
            Telerik.Reporting.ReportHeaderSection ReportHeaderSection = new Telerik.Reporting.ReportHeaderSection();
            Telerik.Reporting.GroupHeaderSection LabelsGroupHeader = new Telerik.Reporting.GroupHeaderSection();
            Telerik.Reporting.DetailSection Detail = new Telerik.Reporting.DetailSection();
            Telerik.Reporting.GroupFooterSection labelsGroupFooter = new Telerik.Reporting.GroupFooterSection();
            Telerik.Reporting.ReportFooterSection ReportFooterSection = new Telerik.Reporting.ReportFooterSection();
            Telerik.Reporting.PageFooterSection PageFooterSection = new Telerik.Reporting.PageFooterSection();
            Telerik.Reporting.SubReport Subreport1 = new Telerik.Reporting.SubReport();

            ReportHeaderSection.Height = globalRowHeight;


            Telerik.Reporting.Panel MasterDetailPanel = new Telerik.Reporting.Panel();
            MasterDetailPanel.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.28, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch));
            MasterDetailPanel.Size = new SizeU(new Telerik.Reporting.Drawing.Unit(0.42, Telerik.Reporting.Drawing.UnitType.Cm), globalRowHeight);
            MasterDetailPanel.Style.BorderStyle.Default = BorderType.Solid;
            MasterDetailPanel.KeepTogether = true;
            MasterDetailPanel.Style.BackgroundColor = Color.CadetBlue;
            ReportHeaderSection.Style.BackgroundColor = Color.CadetBlue;

            Telerik.Reporting.Panel SubDetailPanel = new Telerik.Reporting.Panel();
            SubDetailPanel.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.28, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4, Telerik.Reporting.Drawing.UnitType.Inch));
            SubDetailPanel.Size = new SizeU(new Telerik.Reporting.Drawing.Unit(0.42, Telerik.Reporting.Drawing.UnitType.Cm), globalRowHeight);
            SubDetailPanel.Style.BorderStyle.Default = BorderType.Solid;
            SubDetailPanel.KeepTogether = true;
            SubDetailPanel.Style.BackgroundColor = Color.BlanchedAlmond;
            for (int i = 0; i < colsCount; i++)
            {
                // ReportHeaderSection.........Start...
                Telerik.Reporting.TextBox SingleTextBox = new Telerik.Reporting.TextBox();
                SingleTextBox.Value = data.Columns[i].ColumnName.ToString();
                SingleTextBox.CanGrow = true;

                SingleTextBox.Style.BorderStyle.Default = BorderType.Solid;
                SingleTextBox.Multiline = true;
                SingleTextBox.KeepTogether = true;
                SingleTextBox.TextWrap = true;
                SingleTextBox.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
                SingleTextBox.Size = new SizeU(new Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Inch), globalRowHeight);
                SingleTextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(i - 0.8, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.2, Telerik.Reporting.Drawing.UnitType.Cm));
                ReportHeaderSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { SingleTextBox });
                // ReportHeaderSection.........End...
                //Detail ....................Start....
                Telerik.Reporting.TextBox MasterDetailTextBox = new Telerik.Reporting.TextBox();
                MasterDetailTextBox.Value = "=Fields." + data.Columns[i].ColumnName.ToString();
                MasterDetailTextBox.CanGrow = true;
                MasterDetailTextBox.Multiline = true;
                MasterDetailTextBox.KeepTogether = true;
                MasterDetailTextBox.TextWrap = true;
                MasterDetailTextBox.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
                MasterDetailTextBox.Size = new SizeU(new Telerik.Reporting.Drawing.Unit(5, Telerik.Reporting.Drawing.UnitType.Inch), globalRowHeight);
                MasterDetailTextBox.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(i - 0.6, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.2, Telerik.Reporting.Drawing.UnitType.Cm));


                MasterDetailPanel.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { MasterDetailTextBox });

                //  Detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { MasterDetailTextBox });
                //Detail ....................End....

            }
             ClassLibrary1.Subreport subreport = new ClassLibrary1.Subreport();
            Subreport1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.28, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.4, Telerik.Reporting.Drawing.UnitType.Inch));
            Subreport1.Parameters.Add(new Telerik.Reporting.Parameter("Vendor_Code", null));
            Subreport1.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.7000007629394531, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(1.7000001668930054, Telerik.Reporting.Drawing.UnitType.Inch));
            //Subreport1.ReportSource.DataSource = GetData().Tables[0];
            Subreport1.ReportSource = subreport;
            Subreport1.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.28, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.5, Telerik.Reporting.Drawing.UnitType.Inch));
            Subreport1.NeedDataSource += new EventHandler(Subreport1_NeedDataSource);





            //  Detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { MasterDetailPanel });
            Detail.Height = new Telerik.Reporting.Drawing.Unit(0.42926517128944397D, Telerik.Reporting.Drawing.UnitType.Inch);
            Detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { Subreport1, MasterDetailPanel, SubDetailPanel });
            Detail.Style.BackgroundColor = Color.BurlyWood;
            //  Detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { Subreport1 });            


            Telerik.Reporting.ToggleVisibilityAction toggleVisibilityAction1 = new Telerik.Reporting.ToggleVisibilityAction();
            MasterDetailPanel.Action = toggleVisibilityAction1;
            toggleVisibilityAction1.DisplayExpandedMark = false;
            toggleVisibilityAction1.Targets.AddRange(new Telerik.Reporting.IToggleVisibilityTarget[] { SubDetailPanel });


            PageFooterSection = new Telerik.Reporting.PageFooterSection();
            PageFooterSection.Height = new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch);
            PageFooterSection.Style.BackgroundColor = Color.Brown;
            PageFooterSection.PrintOnFirstPage = true;
            PageFooterSection.PrintOnLastPage = true;
            Telerik.Reporting.TextBox txtFooter = new Telerik.Reporting.TextBox();
            txtFooter.Value = "='Page ' + PageNumber + ' of ' + PageCount";
            txtFooter.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(4.2395832538604736D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505D, Telerik.Reporting.Drawing.UnitType.Inch));
            txtFooter.Name = "pageInfoTextBox";
            txtFooter.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(5.5603775978088379D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType.Inch));
            //Telerik.Reporting.PictureBox picBoxFooter = new Telerik.Reporting.PictureBox();
            //picBoxFooter.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.2395832538604736D, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.02083333395421505D, Telerik.Reporting.Drawing.UnitType.Inch));
            //picBoxFooter.Value = @"Images\no.png";
            //picBoxFooter.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
            //picBoxFooter.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Inch))), new Telerik.Reporting.Drawing.Unit(.5D, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Inch))));
            //picBoxFooter.Sizing = ImageSizeMode.AutoSize;
            PageFooterSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { txtFooter });
            Report Report = new Report();
            Report.DataSource = data;



            Report.Items.Add((ReportItemBase)PageHeader);
            Report.Items.Add((ReportItemBase)ReportHeaderSection);
            //   Report.Items.Add((ReportItemBase)LabelsGroupHeader);           
            Report.Items.Add((ReportItemBase)Detail);
            Report.Items.Add((ReportItemBase)labelsGroupFooter);
            Report.Items.Add((ReportItemBase)ReportFooterSection);
            Report.Items.Add((ReportItemBase)PageFooterSection);

            ReportViewer1.Report = Report;

        
        }
        
Peter
Telerik team
 answered on 25 Nov 2011
1 answer
238 views
Dear

I am building the Chart in the Reporting, i am manually binding the data using a data table, in that total 3 columns i want to set one to X axis and other to Y axis and another to Secondary Y axis,

I am tring to bind it, but its not taking the Secondary Y axis...

I am using in this manner
 rpt.Chart1.Series(0).PlotArea.YAxis.YAxisType = Telerik.Charting.ChartYAxisType.Secondary

Waiting For the Replay...

Thanks 
Purna
Elian
Telerik team
 answered on 25 Nov 2011
1 answer
272 views
I am getting WCF service exception when I am trying to add huge data to report parameter, if we send small chunk of data its working fine. do verify my code and suggest me the right way to add parameter data. Added web.config setting along with the reportviewer code.
<bindings>
      <customBinding>
        <binding name="BinaryHttpBinding">
          <binaryMessageEncoding>
            <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
          </binaryMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
</bindings>

public partial class ReportViewer : Page, IReportServiceClientFactory
   {
       public ReportSettingsDTO ReportParametersObject { get; set; }
       public ReportViewer()
       {
           InitializeComponent();
           this.rptViewer.ReportServiceClientFactory = this;
           this.rptViewer.Report = "WebClient.Reports.TestReport, WebClient";
           this.rptViewer.RenderBegin += new RenderBeginEventHandler(rptViewer_RenderBegin);
       }
 
       void rptViewer_RenderBegin(object sender, RenderBeginEventArgs args)
       {
           args.ParameterValues["ParameterObject"] = serialize();
       }
       public string serialize()
       {
           MemoryStream ms = new MemoryStream();
 
           // Serializer the User object to the stream.
           DataContractSerializer ser = new DataContractSerializer(typeof(ReportSettingsDTO));
           ser.WriteObject(ms, ReportParametersObject);
           byte[] array = ms.ToArray();
           ms.Close();
           return Encoding.UTF8.GetString(array, 0, array.Length);
       }
 
       #region IReportServiceClientFactory Members
 
       ReportServiceClient IReportServiceClientFactory.Create(System.Uri remoteAddress)
       {
           var binding = new BasicHttpBinding()
           {
               TransferMode = System.ServiceModel.TransferMode.Buffered,
               MaxBufferSize = int.MaxValue,
               MaxReceivedMessageSize = int.MaxValue,
               OpenTimeout = new TimeSpan(0, 15, 0),
               ReceiveTimeout = new TimeSpan(0, 15, 0),
               SendTimeout = new TimeSpan(0, 15, 0)
           };
 
           var endpointAddress = new EndpointAddress(remoteAddress);
 
           return new ReportServiceClient(binding, endpointAddress);
       }
 
 
       #endregion
   }
Steve
Telerik team
 answered on 25 Nov 2011
1 answer
63 views
hi !
can any one please guide me that how to pass parameters in telerik , please also give any example so that i can easily understand it , as i am very new in telerik reporting .

Best Regards

Waqas
Steve
Telerik team
 answered on 25 Nov 2011
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?