cancel
Showing results for 
Search instead for 
Did you mean: 

Set a XML string as datasource in Report

Former Member
0 Kudos

I need set a XML string as datasource from report document. In many examples I see the use of Datasets for upset the XML data in Report. Is possible launch the report with only the XML? I need it that for performance purposes: the DataSet object is very slow.

I did try build a XMLDocument object from the XML string, but when i pass it to Report Document the data not appears. Seems don´t accept that source type.

Regards and many thanks for the help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member208657
Active Contributor
0 Kudos

Reporting off of an XML string isn't going to be much faster. Crystal Reports is slow with datasets because we have to do all the sorting client side. The same will apply with your XML file data because there is no database to do some of the sorting work for us.

You should be able to use the ReportDocument.SetDatasource("C:\Path\To\Xml\File\myXML.xml") to point directly to the XML file.

Performance warning: This database driver should be used for small sets of data. It does not perform well with lots of data. Once you go above 10k to 20k rows of data you'll see significant performance issues - especially if you have multiple linked tables. Use a flat XML structure for best results.

Former Member
0 Kudos

When I try

ReportDocument.SetDatasource("C:PathToXmlFilemyXML.xml")

the report don´t show data. The same xml file with the Dataset mechanism works good. Is needed something more for works?

The XML used is that:

¿report?

  ¿header nombre.informe="Informe Resumen de Documento" Fecha="Tue May 31 12:32:56 CEST 2011"/?

  ¿documentos?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Testamento" nota.codigoUltimasVoluntades="COD." nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0001" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0601/0000" operacion.descripcionActoJuridico="Compraventa" nota.codigoUltimasVoluntades="COD: UV" nota.apellido2="Apellido2" documento.identificacionDocumento.numeroDocumento="11-0001" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0001" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0001" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0004" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0004" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0004" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0006" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0006" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0006" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0006" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0006" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0007" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

    ¿documento operacion.cuantiaTotal="35500.34" operacion.codigoActoJuridico="0501/0000" operacion.descripcionActoJuridico="Descripcion acto jurídico" nota.codigoUltimasVoluntades="CODI 342875" nota.apellido2="Apellido1" documento.identificacionDocumento.numeroDocumento="11-0009" nota.nombre="Nombre" nota.apellido1="Apellido1"/?

  ¿/documentos?

¿/report?

The text don´t allow write xml code correctly; please, change the {} for ¿?

Many thanks for the help.

Edited by: nullPointer on Jun 3, 2011 10:38 AM

Edited by: nullPointer on Jun 3, 2011 10:38 AM

Edited by: nullPointer on Jun 3, 2011 10:39 AM

Edited by: nullPointer on Jun 3, 2011 10:43 AM

0 Kudos

Create a new report, In the Database Wizard select ADO.NET ( XML ), browse to your XML file and then drop the fields into the report. If you don't see fields or data then your XML is not in the correct format.

Create another new report and this time connect to your database directly using ODBC or OLE DB. Drop the fields you want in your XML file into the report and then Preview. If the data is there then export the report to XML. Now go back and create a new report off of that new XML file and you should see data.

Now compare your original XMl to the new XML and you'll see what CR Requires in the XML file.

Don

former_member208657
Active Contributor
0 Kudos

I agree with Don here. Create a new report using Crystal and point it at your XML file. If you don't see fields then your XML isn't formatted the way we expect.

Former Member
0 Kudos

I´m using a XSD instead the XML file. I will prove bind the XML, but I understand must be the same.

Anyway is strange a XML binded through dataset works very good and don´t works when I use directly the XML.

Many thanks for the help. I will do the prove.

former_member208657
Active Contributor
0 Kudos

The XSD is normally just the data structure - NO DATA. So it would make sense that no results are showing up in your report. It's possible to write out an XML file with the schema, which is what I would recommend you do.

0 Kudos

Do so this way from your dataset ( ds):

ds.WriteXml("c:
sc.xml", XmlWriteMode.WriteSchema);

Thank you

Don

Answers (0)