Prodataset to .NET Dataset

Posted by Roger Blanchard on 09-Jun-2009 15:15

I have a prodataset that I am currently using the WRITE-XML method to save off to disk. I then set this file as my datasource for a crystal report. I was wondering if there is a way (without Appserver) to feed this prodataset to Crystal without writing to disk first? Basically, Crystal is expecting a .NET Dataset.

All Replies

Posted by jquerijero on 16-Jun-2009 10:01

You can try saving a ProDataSet to a LONGCHAR and use XmlDataDocument class LoadXml(...). XmlDataDocument has a .NET DataSet property that gets filled in.

Posted by Roger Blanchard on 16-Jun-2009 13:31

Joseph,

Thanks for the response. I will give it a try.

Posted by Roger Blanchard on 16-Jun-2009 13:51

Joseph,

The LoadXML appears the load the LONGCHAR just fine as if I use the Save as a test I do get the proper XML file.

rXMLDataDocument:LoadXML (lcDatasource).

rXMLDataDocument:

SAVE ("roger.xml"

).

Now when I attempt to setDatasource on the Crystal REport Documet I do not get an error but no data appears on the report.

I changed the code from:

rReportDocument:SetDatasource (rDataset).

To:

rReportDocument:SetDatasource (rXMLDataDocument:

Dataset).

Any ideas?

Posted by jquerijero on 16-Jun-2009 15:31

We need to check if the DataSet property is being filled in. XmlDataDocument will still read the XML data, but might not fill the DataSet property. Try calling the XmlDataDocument:DataSet:WriteXml() to see if the DataSet is filled.

By the way, are you also exporting the schema to the LONGCHAR? If yes, try just exporting the data.

Posted by Roger Blanchard on 16-Jun-2009 16:23

I am not exporting the schema to the LONGCHAR just the data. I did as you mentioned and called XMLDataDocument:Dataset:WriteXML() and there is NO data in the XML file I create on disk. So the Dataset is not being filled?

Posted by jquerijero on 16-Jun-2009 16:45

Hmm it looks like you will need to export the ProDataSet schema using WRITE-XMLSCHEMA to a LONGCHAR.

After calling the NEW XMLDataDocument . .

myDataDoc.DataSet.ReadXmlSchema(myLongChar).

Then proceed with the XML load.

NOTE: It's not surprising to have some trouble with cross-party (Progress, Microsoft, Java, and etc.) XSD load even if the parties claim they are following the standard. You might need to clean the generated XSD and save it.

Posted by Roger Blanchard on 16-Jun-2009 17:03

I have attached a sample as well.

Northeast PriceZone

1

0.0

5.0

1.0

0.0

0.0

0.0

Test Item

0

1

0.0

2008-07-08

52.79

1

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

10.59

9.0

8.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

6.0

0.0

0.0

0.0

$

0000000000

1

1

1

1

01234569999

1

1

3

0123456

0.0

0.0

0.0

0.0

0.0

0.0

Allow Neg Accumulation

0

2

0.0

2008-07-08

99.99

1

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

4.59

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

0.0

$

0000000000

1

2

1

1

01111142577

404 County St.

New Bedford

Osprey Retail Systems, Inc.

true

true

true

true

true

true

false

true

true

true

true

true

false

false

false

5089921098

Osprey Retail Systems, Inc.

5

MA

04/08/09

5

027404936

Posted by jquerijero on 16-Jun-2009 17:05

Can you also paste the xsd generated by Progress?

Posted by Roger Blanchard on 16-Jun-2009 17:33


http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:prodata="urn:schemas-progress-com:xml-prodata:0001">
 
   
     
       
         
           
             
             
             
             
               
                 
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                   
                     
                       
                         
                         
                         
                         
                         
                         
                         
                         
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
       
         
           
             
             
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
       
         
           
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
           
         
       
     
   
   
     
     
   
   
     
     
     
     
   
   
     
     
   
   
     
     
     
     
   
   
     
     
   
   
     
     
   
   
     
     
   
   
     
     
     
     
   
   
     
     
     
     
   
   
     
     
     
     
     
     
   
   
     
     
     
     
   
   
     
     
   
 
 
   
     
   
 

Posted by jquerijero on 16-Jun-2009 18:04

Try loading the XSD using a file first just to make sure it works then work on loading the LONGCHAR. Even in Visual Studio-based project the DataSet is not being loaded if the schema is not provided.

doc.DataSet.ReadXmlSchema("roger.xsd")

I tried your files, and they seem to load fine.

Posted by Roger Blanchard on 16-Jun-2009 18:21

Joseph,

Success!! When I was using just the Dataset I was not loading the schema and it worked so when using the XMLDataDocument:Dataset I was not loading the schema either. I added the ReadXMLSchema and everything now appears to work.

Thanks for all the help.

rXMLDataDocument:

DATASET

:ReadXMLSchema(

This thread is closed