Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric problem with received XML data
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
Numeric problem with received XML data
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01097069
Message ID:
01097069
Views:
58
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,
Michael McLain
Next
Reply
Map
View

Click here to load this message in the networking platform