XML and NULL values for Numeric fields

Stimulsoft Reports.WEB discussion
Post Reply
patwolf
Posts: 90
Joined: Thu May 29, 2008 1:38 pm
Location: Los Angles

XML and NULL values for Numeric fields

Post by patwolf »

How can NULL values be handled for numeric types through XML please? In the below example I get an error but when I enter 0 as the numeric value in the XML it works.
But as you know 0 != NULL :)

Thanks a lot,
Patrick

XSD

Code: Select all

<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shotgun">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="version">
<xs:complexType><xs:sequence>
<xs:element name="id" type="xs:integer" />
<xs:element name="frame_count" type="xs:integer" minOccurs="0" />
<xs:element name="sg_frames_aspect_ratio" type="xs:decimal" minOccurs="0" />
</xs:sequence></xs:complexType></xs:element>
</xs:choice></xs:complexType></xs:element>
</xs:schema>
XML

Code: Select all

<?xml version="1.0"?>
<shotgun>
  <version>
    <id>3743</id>
    <frame_count></frame_count>
    <sg_frames_aspect_ratio></sg_frames_aspect_ratio>
  </version>
</shotgun>
Error

Code: Select all

System.FormatException was caught
  Message=Input string was not in a correct format.
  Source=mscorlib
  StackTrace:
       at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
       at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Data.Common.Int64Storage.ConvertXmlToObject(String s)
       at System.Data.XmlDataLoader.LoadColumn(DataColumn column, Object[] foundColumns)
       at System.Data.XmlDataLoader.LoadTable(DataTable table, Boolean isNested)
       at System.Data.XmlDataLoader.LoadData(XmlReader reader)
       at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
       at System.Data.DataSet.ReadXml(String fileName)
       at sg.reporting.webapp.Default.GetDs() in D:\Data\Documents\My Dropbox\Pixo_Pat\Code\user_patrickwolf\src\sg_reporting\src\sg.reporting\sg.reporting.webapp\Default.aspx.cs:line 140
       at sg.reporting.webapp.Default.PreviewReport(String fpn) in D:\Data\Documents\My Dropbox\Pixo_Pat\Code\user_patrickwolf\src\sg_reporting\src\sg.reporting\sg.reporting.webapp\Default.aspx.cs:line 160
  InnerException: 
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: XML and NULL values for Numeric fields

Post by HighAley »

Hello.

There is no Stimulsoft methods in the error stack. It's a .Net framework error.
Your type is not nullable so you get this error.

Thank you.
patwolf
Posts: 90
Joined: Thu May 29, 2008 1:38 pm
Location: Los Angles

Re: XML and NULL values for Numeric fields

Post by patwolf »

If anybody else has the same problem.
http://msdn.microsoft.com/en-us/library/ybce7f69
<xsd:element name="key" type="xsd:string" nillable="true" />
<key xsi:nil="true"/>
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: XML and NULL values for Numeric fields

Post by HighAley »

Hello.

In your first message the nillable attribute wasn't set to true. So did you solve your problem now?

Thank you.
roomy
Posts: 61
Joined: Mon May 06, 2013 12:34 pm

Re: XML and NULL values for Numeric fields

Post by roomy »

Hi,

I have the same issue. But here I just create a XML datasource and table inside mrt and pass xml to show data,
Where i put the nillable="true" in mrt file???

Please find the attachement.
I attach a xsd file for Issue, But actualy I dont have it directly in mrt.

Thanks
Attachments
testd.rar
(3.04 KiB) Downloaded 377 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: XML and NULL values for Numeric fields

Post by HighAley »

Hello.

Could you understand your issue more detailed?
What problem do you have?

Thank you.
Post Reply