Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric problem with received XML data
Message
From
20/02/2006 19:35:27
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097069
Message ID:
01097629
Views:
16
Do you need to have the schema in-line? It seems that that is where your problem is (since the field is being defined as decimal and you probably need it to be integer?) ... If you used a pre-defined DataSet on the .NET side, you can specify this field as integer and then you won't be relying on the schema sent from the Web Service.

Just some food for thought ...

~~Bonnie




>Hi Bonnie,
>
>The dataset is being defined and populated from the same vfp tables using a VFP web service. The schema is inline with the data and is defined as:
>
>
<xsd:element name="tempno">
> <xsd:simpleType>
>  <xsd:restriction base="xsd:decimal">
>   <xsd:totalDigits value="10"/>
>   <xsd:fractionDigits value="0"/>
>  </xsd:restriction>
> </xsd:simpleType>
></xsd:element>
>
>Once the tempno field is created in the dataset it is defined as Int32. It’s interesting to note that the dataset returns the field’s data type as decimal with no total and fraction information to the VFP web service.
>
>I’m not trying to resolve this specific issue but rather attempting to determine the best approach for accessing the data. My first choice was to use oledb but I need it function in 64 bit mode. With a growing number of issues I may abandon the web service approach as well. Starting to look like a data bridge, grrr….
>
>>How are the datatypes of your .NET dataset defined? Are you getting the data initially from somewhere else? Are you using an .xsd for the schema? In other words, how is the datatype being defined initially as decimal? Seems to me you want an integer. If you used an .xsd schema for your DataSet, you could simply change that column to int in the .xsd.
>>
>>~~Bonnie
>>
>>
>>
>>>Aleksey,
>>>
>>>Thanks for the info. The type definition is being generated from .NET Dataset using:
>>>
>>>StringWriter sw = new StringWriter();
>>>dataSet.WriteXml(sw, XmlWriteMode.WriteSchema);
>>>
>>>I will have to patch the issue within the VFP web service.
>>>
>>>Thanks,
>>>Mike
>>>
>>>>This can cause the problem. Either include totalDigits and fractionDigits facets into XML type definition for tempno or manually adjust VFP data type for corresponding XMLField object.
>>>>
>>>>>The index expression is simply on the field which is a numeric type N(10,0). The cursor created by the xmlAdapter shows numeric type N(20,19) which seems a bit odd. The value in the cursor appears as 29131.00000000000000
>>>>>
>>>>>>Hi Michael,
>>>>>>
>>>>>>Is the type of the index expression the same as the type of the header.tempno field?
>>>>>>
>>>>>>Aleksey.
>>>>>>
>>>>>>
>>>>>>>I’m sending a dataset from .NET 2.0 to a VFP web service. When I receive the data into VFP there appears to be something strange happening with numeric fields.
>>>>>>>
>>>>>>>You can save numeric data and perform arithmetic operations with no problem. If I take a numeric value and attempt a seek on a table it will not find the matching record. If I perform any type of arithmetic op on the value prior to the seek it will find the record.
>>>>>>>
>>>>>>>VFP Test code:
>>>>>>>PROCEDURE UpdateTemplate(lcXMLDataSet as String) as String
>>>>>>>   LOCAL loXMLAdapter AS XMLAdapter
>>>>>>>   loXMLAdapter = CREATEOBJECT("XMLAdapter")
>>>>>>>   loXMLAdapter.LoadXML(lcXMLDataSet)
>>>>>>>   loXMLAdapter.Tables(1).ToCursor(.f.,"header")
>>>>>>>   loXMLAdapter.Tables(2).ToCursor(.f.,"detail")
>>>>>>>   loXMLAdapter.Tables(3).ToCursor(.f.,"smartcode")
>>>>>>>   USE (datapath + "gphmast.dbf") SHARED IN 0
>>>>>>>   USE (datapath + "gphdtail.dbf") SHARED IN 0
>>>>>>>   USE (datapath + "gphesc.dbf") SHARED IN 0
>>>>>>>   SELECT header
>>>>>>>   m.tempno = tempno	&&Get PK value to search for
>>>>>>>   SELECT gphmast
>>>>>>>   SET ORDER TO tempno
>>>>>>>   IF SEEK(m.tempno)	&& --- Seek Fails!
>>>>>>>      rtnval = "Record Found!"
>>>>>>>   ELSE
>>>>>>>      rtnval = "Template " + str(m.tempno) + " Not found.
>>>>>>>   ENDIF
>>>>>>>   RETURN rtnval
>>>>>>>ENDPROC
>>>>>>>
>>>>>>>If I change the seek to: “SEEK (m.tempno+0)” it finds the matching record.
>>>>>>>Other commands that failed were:
>>>>>>>LOCATE FOR tempno = m.tempno
>>>>>>>SELECT * FROM gphmast where tempno = m.tempno
>>>>>>>
>>>>>>>If I locate the record and compare it will match
>>>>>>>SELECT (29131)
>>>>>>>Compairing Tempno = m.Tempno returns true
>>>>>>>
>>>>>>>When I save the received data into the datatable everything looks ok. It seems to be something with using the numeric value against a table index.
>>>>>>>
>>>>>>>The XML string received by the VFP web service has the value defined as:
>>>>>>>Schema:
>>>>>>>
<xs:element name="tempno">
>>>>>>> <xs:simpleType>
>>>>>>>  <xs:restriction base="xs:decimal" />
>>>>>>> </xs:simpleType>
>>>>>>></xs:element>
>>>>>>>Data:
>>>>>>>    <tempno>29131</tempno>
>>>>>>>
>>>>>>>
>>>>>>>When I run similar code from the command window (pulling the xml from a file) it finds the record.
>>>>>>>
>>>>>>>Can anybody shed some light on what is happening here?
>>>>>>>
>>>>>>>Thanks,
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform