Telerik Forums
Reporting Forum
1 answer
105 views
Hello.

After you helped me in this thread, I was able to get nested tables working using a custom object.

I then revisited the topic, reread the links you provided and got it working with a dataset with datarelations established on the dataset.  However, the solution I arrived at was so convoluted, I'm fairly certain that it isn't the intended way to accomplish that goal.

Could someone please look at the code below, tell me if it's the way we're intended to do this, and if not, provide an example of the correct method?  I suspect I'm doing this incorrectly because of the all the casting going on down in the getChildItem f(x).

The workers class is for making the dataset, including the datarelations and some randomly generated data.  To save typing I'm just grabbing the custom object from when I was testing that approach, and turning it into a dataset.

The createReportFromDS and getChildItem are in the actual report object.  There are two table objects on the report: tblParent, and nested within it, tblChild.

Public Function createReportFromDS() As Byte()
    Dim ods As New ObjectDataSource
 
    ods.DataSource = cboSample.workers.getWorkers
    ods.DataMember = "workers" 'casing has to match
    tblParent.DataSource = ods
    tblChild.Bindings.Add(New Telerik.Reporting.Binding("DataSource", "=getChildItem(ReportItem.DataObject)"))
 
    Return generateReportObj()
End Function
 
Public Shared Function getChildItem(sender As Object) As DataTable
    Dim dataObject = DirectCast(sender, Telerik.Reporting.Processing.IDataObject)
    Dim dt As DataTable = CType(CType(dataObject.RawData, DataRowView).Row, DataRow).GetChildRows("WtoT").CopyToDataTable()
 
    Return dt
End Function




Public Class workers
    Public Shared Function getWorkers() As DataSet
        Dim ds As DataSet = getDS()
        Dim myCbo As New dataItems
        Dim myWorkers As IEnumerable(Of parentItem) = myCbo.GetData 'to save typing just grab the custom object previously created and turn it into tables in a dataset
        Dim i As Integer
 
 
        'process the items
        For Each w As parentItem In myWorkers
            ds.Tables("workers").Rows.Add(i, w.worker, w.age)
            For Each t As childItem In w.tasks
                ds.Tables("tasks").Rows.Add(i, t.taskName, t.timeRequired, t.difficulty.ToString)
            Next
            i += 1
        Next
 
        Return ds
    End Function
 
    ''' <summary>
    ''' Returns a ds with columns and datarelations established
    ''' </summary>
    ''' <returns></returns>
    Private Shared Function getDS() As DataSet
        Dim dtP, dtC As DataTable
        Dim ds As New DataSet
 
        dtP = New DataTable("workers")
        dtP.Columns.Add("pk", GetType(Integer))
        dtP.Columns.Add("worker")
        dtP.Columns.Add("age")
        dtP.PrimaryKey = New DataColumn() {dtP.Columns("pk")}
 
        dtC = New DataTable("tasks")
        dtC.Columns.Add("fk", GetType(Integer))
        dtC.Columns.Add("taskName")
        dtC.Columns.Add("timeRequired")
        dtC.Columns.Add("difficulty")
 
        ds.Tables.AddRange(New DataTable() {dtP, dtC})
 
        ds.Relations.Add("WtoT", ds.Tables("workers").Columns("pk"), ds.Tables("tasks").Columns("fk"))
 
        Return ds
    End Function
End Class
Nasko
Telerik team
 answered on 12 Dec 2013
21 answers
510 views
I'm guessing the answer will be to upgrade my reporting, but I'd rather not upgrade telerik reporting right now.  I just don't want to have to copy over all those dlls.

I'm getting:
System.Windows.Markup.XamlParseException occurred
  HResult=-2146233087
  Message='Initialization of 'Telerik.ReportViewer.Wpf.ReportViewer' threw an exception.' Line number '23' and line position '27'.
  Source=PresentationFramework
  LineNumber=23
  LinePosition=27
  StackTrace:
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at LawtimeMain.ReportWindow.InitializeComponent() in c:\source\VSApps\LawtimeMainWPF\LawtimeMain\LawtimeMain\ReportOptions\ReportWindow.xaml:line 1
       at LawtimeMain.ReportWindow..ctor(String reportType, ParameterCollection pc) in c:\source\VSApps\LawtimeMainWPF\LawtimeMain\LawtimeMain\ReportOptions\ReportWindow.xaml.cs:line 20
  InnerException: System.Xaml.XamlObjectWriterException
       HResult=-2146233088
       Message=Set property 'System.Windows.ResourceDictionary.Source' threw an exception.
       Source=System.Xaml
       LineNumber=0
       LinePosition=0
       StackTrace:
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
            at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)
            at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)
            at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
            at System.Xaml.XamlObjectWriter.WriteEndMember()
            at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
            at System.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled)
            at System.Windows.SystemResources.ResourceDictionaries.LoadGenericDictionary(Boolean isTraceEnabled)
            at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
            at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
            at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
            at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
       InnerException: System.Windows.Markup.XamlParseException
            HResult=-2146233087
            Message=Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.
            Source=PresentationFramework
            LineNumber=0
            LinePosition=0
            StackTrace:
                 at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
                 at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
                 at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
                 at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
                 at MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)
                 at System.Windows.ResourceDictionary.set_Source(Uri value)
                 at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
            InnerException: System.NotImplementedException
                 HResult=-2147467263
                 Message=The method or operation is not implemented.
                 Source=PresentationFramework
                 StackTrace:
                      at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
                      at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
                      at System.Windows.Baml2006.Baml2006Reader.Process_PropertyTypeReference()
                      at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
                      at System.Windows.Baml2006.Baml2006Reader.ReadKeys()
                      at System.Windows.ResourceDictionary.SetDeferrableContent(DeferrableContent deferrableContent)
                      at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<Create_BamlProperty_ResourceDictionary_DeferrableContent>b__168(Object target, Object value)
                      at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
                 InnerException: 

Stef
Telerik team
 answered on 12 Dec 2013
10 answers
622 views
Hi,

I have managed to get all report functionality working with a SQL Express database (in web application), but when I try to connect to a SQL Server Compact database, I get the following error: 

An error has occurred while processing Report 'OutstandingPayments':
Unable to establish a connection to the database. Please, verify that your connection string is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application.
------------- InnerException -------------
Unable to find the requested .Net Framework Data Provider. It may not be installed.


The code behind the report designer is this:

this.sqlDataSource1.ConnectionString = "Data Source=\"C:\\Users\\Amecily\\Desktop\\Wits\\DFP v2.1\\Latest\\DFPProductions_Default" +
   "\\DFPProductions_Default\\App_Data\\DFP.sdf\"";
           this.sqlDataSource1.Name = "sqlDataSource1";
           this.sqlDataSource1.ProviderName = "Microsoft.SqlServerCe.Client.4.0";
           this.sqlDataSource1.SelectCommand = resources.GetString("sqlDataSource1.SelectCommand");

Is there something I need to do to the connection string?

Thanks,
Amy
Hinata
Top achievements
Rank 1
 answered on 11 Dec 2013
2 answers
273 views
Hello
Is there template available to use with font awesome version 4+?

Regards
Marcin
Marcin
Top achievements
Rank 1
Veteran
 answered on 11 Dec 2013
1 answer
114 views
Am I missing something?  I go to the demos on reporting, I see a demo "Invoice" that is nearly identical to what i'm looking to do.  I don't see the code pages like in the other products.

I just need to see the html/javascript mockup, and i'd like to bind my report to a class.  If that's possible.

Thanks
Stef
Telerik team
 answered on 11 Dec 2013
1 answer
72 views
Hi

I've gone through the quickstart tutorial to display a report, but intellisense underlines the report viewer with the following error:

unknown type or namespace 'Reportviewer' of 'Telerik'

It doesn't look like the reports have registered properly.

Andy
Stef
Telerik team
 answered on 10 Dec 2013
1 answer
129 views
We have a report that is developed using the standalone designer. The xaxis scale is a date value. We are trying to configure the chart to show only every 3rd or 4th axis value; however in order to do that the scale needs to be changed to DateTime. When we try to do that in the designer, it crashes.

Also, is it possible to programmatically interact with reports in the standalone designer? In the VS designer you can access code-behind, but it doesn't seem clear if there is any way to do that with TRDX files.
Nasko
Telerik team
 answered on 10 Dec 2013
5 answers
808 views
Hi,

I'm having Telerik.Reporting.OpenXmlRendering.dll, DocumentFormat.OpenXml.dll in my dev server. But while executing the report, its showing the error, 'DOCX rendering format is not available.'. But when I tried to debug in my local pc, its working fine.

Please help me on this...


Thanks,
Mahesh O A
thelostleaf
Top achievements
Rank 2
 answered on 09 Dec 2013
8 answers
1.3K+ views
Hi -
I read in the Telerik documentation that you may export to word but I do not have that option in the asp.net report viewer.
How do I get this option to show.
Thanks
Andy
SOFIENE
Top achievements
Rank 1
 answered on 09 Dec 2013
1 answer
325 views
hello, i hope someone can help me with this problem.  

I have a mvc web app that has an edmx connection setup.  i added a class library to run the reports and created a new edmx in that class library.  

i am trying to setup a simple test report using the new HTML5 viewer.

I setup entity framework using your articles which seemed to work.

I am getting the dreaded 'Format of the initialization string does not conform to specification starting at index 0.' error and although i have copied the connection string from my reports project app.config to the main application web.config, i still get this error when trying to view the report through the application.  The report is visible using the preview mode in the visual studio.

The report only has one table on it which was setup using the table wizard.

my connection strings in the web.config:
   
<add name="TargetZeroEntities" connectionString="metadata=res://*/TargetZero.csdl|res://*/TargetZero.ssdl|res://*/TargetZero.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=uldev02\sql2008;initial catalog=TargetZero;persist security info=True;user id=TargetZeroDev;password=TargetZeroDev1@;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /><br>
    <add name="TargetZeroReportEntities" connectionString="metadata=res://*/ReportingContext.csdl|res://*/ReportingContext.ssdl|res://*/ReportingContext.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=uldev02\sql2008;initial catalog=TargetZero;persist security info=True;user id=TargetZeroDev;password=TargetZeroDev1@;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient"/>


The 2nd one(TargetZeroReportEntities) is used for the reporting project and was copied exactly as is from that project.

the report is very simple:
constructor{
            InitializeComponent();

            this.DataSource = entityDataSource1;
            this.table1.DataSource = entityDataSource1;
}

any suggestions to resolve this error?

EDIT: this has nothing to do with the table on the report.  I tried deleting that and i still get the same error.

EDIT2:  i have also gone through this article on setting up the datasource manually for production but it did not resolve this issue.
Stef
Telerik team
 answered on 09 Dec 2013
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?