Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making a generic Crystal Reports class
Message
From
29/01/2008 08:37:11
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01285992
Message ID:
01286554
Views:
21
>>>>>>>>Hey gang,
>>>>>>>>Here is my situation - I am attempting to build a generic Crystal Reports class where the end-user provides a path to the .rpt file, a path to an .xml file, and other options on how to export the report. A requirement is for the .xml file to have an external schema.
>>>>>>>>
>>>>>>>>In my class, I am importing the .xml into an un-typed DataSet using the DataSet.ReadXML method and passing that into the report. The problem is that all of my fields are converted to strings somehow and it my report I get errors when I try to multiply two numeric values in a formula.
>>>>>>>>
>>>>>>>>How can I make this work so the types of my values are preserved?
>>>>>>>>
>>>>>>>>Thanks!!!
>>>>>>>>
>>>>>>>>EDIT, this isn't an ASP.NET post - somehow that got incorrectly set.
>>>>>>>
>>>>>>>DataSet.ReadXML has a couple of overloads. Did you look into them? One of the overloads should read the schema of the XML before reading the data.
>>>>>>
>>>>>>Yes, I looked at those but I think they only read an inline schema. I found a ReadXMLSchema method where I can define the actual .xsd file and then the DataSet becomes strongly typed. However I can't seem to successfully read the data in using ReadXML after I do this.
>>>>>
>>>>>Try using xmlreadmode IgnoreSchema or InferSchema in ReadXml after using ReadXmlSchema.
>>>>>Are you sure that your data matches your schema?
>>>>
>>>>I will try that tonight. Thanks for the suggestion.
>>>>
>>>>Is there an easy way to tell if it matches the schema? There are several records and several fields and it is not practical to visually inspect.
>>>
>>>I am sorry to tell you that the only reliable way I have found to check if the data matches the schema is to do it by hand :(
>>>I usually remove half the data and then try it, if that works then I know it is the other half of data that is "bad".
>>>Do you create the schema or the data or both?
>>
>>I created the schema but the data is coming from another system. I wonder if there is some utility out there that would match xml data and schema. Maybe I will hit up Google later.
>
>One thing that I run into all the time is nullable fields. I do not like nullable fields, and when I set up my schema I explicitly set the field property to not allow null. When I get the data and the data allows nullable fields exceptions are thrown.
>
>Please let me know if your googling turns up and good utility

Einar,
I found this site, although I haven't tried it because I don't have my xml file and schema handy: http://tools.decisionsoft.com/schemaValidate/
Very fitting: http://xkcd.com/386/
Previous
Reply
Map
View

Click here to load this message in the networking platform