wwBusinessObject::convertdata

Converts data from a cursor or the current object into the requested result mode.

Note this functionality is also accessible via the Query() methods, lnResultMode parameter which uses the same result mode settings.

o.ConvertData(lnResultMode, lcDocRoot, lcTable, lcRow)

Return Value

.T. or .F. depending on success or failure

vResult is set with the value of the conversion (ie. string from XML, JSON, EncodeDbf results, Collection, ADO Recordset etc.)

Parameters

lnResultMode

Cursor XML Modes
0 - VFP Cursor (just returns)
1 - XML from cursor
2 - XML from cursor with Schema
3 - XML from cursor with DTD
5 - XML from Cursor using VFPs CursorToXML
6 - XML from Cursor using VFPs CursorToXML with Schema

Object XML Modes:
11 - XML from oData member
12 - XML from oData member with Schema 13 - XML from oData member with DTD
20 - XML from object hierarchical (No Schema/DTD)

Json Modes:
50 - Raw unformatted Json
51 - Formatted Json

Miscellaneous Modes:
30 - ADO recordset from cursor
40 - Binary conversion of VFP cursor (EncodeDbf)
64 - FoxPro Collection of objects

lcDocRoot
Optional - Docroot element name for generated XML

lcTable
Optional - table level element name

lcRow
Optional - row level element name

Remarks

All results are stored into the vResult property.

The cursor export methods work on the currently open cursor so the following works:

o = CREATEOBJECT('wwbusiness')
use Customers

o.ConvertData(2)
ShowXML(o.vResult)

o.ConvertData(51)
ShowText(o.vResult) && JSON String

o.ConvertData(64) && Collection
loCol = o.vResult
loCust = loCol.Item(1)
? loCust.FirstName

Usually you'll want to use Query() with the lnResultMode parameter set.


See also:

Class wwbusiness | wwbusiness::importdata

© West Wind Technologies, 1996-2018 • Updated: 11/09/18
Comment or report problem with topic