>I'm using VFP 7 build 9147 and I'm trying to get the CursorToXML() fuction to really work. It runs and reports a number of bytes written, but no file is ever created.
>
>I have a form with a listbox listing different databases in the DBC. In the When method of the listbox, I populate to form properties. Then I have a button on the form to create XML file. Below is the code from the button:
>
>[code]
>
>LOCAL mcInputFile,mcOutputFile,lnBytes
>mcInputFile=thisform.frmselectedfile
>mcOutputFile=thisform.frmoutputfile
>IF !USED(mcInputFile)
> use &mcInputFile ALIAS &mcInputFile
>ENDIF
>SELECT &mcInputFile
>IF FILE(mcOutputFile)
> DELETE FILE &mcOutputFile
>endif
>lnBytes=CursorToXML(mcInputFile, mcOutputFile,3,"1")
>=MESSAGEBOX("The Export has completed, total bytes written="+ALLTRIM(STR(lnBytes)),0,"Output Completed")
>
>[/code]
>
>It runs, just doesn't produce any output. Anybody know what I'm doing wrong?
>
>Kirk
Kirk,
The nFlags parameter of CursorToXML allows you to control various things, one of which is whether the output is to a memvar or a file. By default, the output goes to a memvar so your line of code is outputting to a memvar. You need to set flag 512 to tell it to output to a file. I know the order of the parameters have changed a bit between versions so I'm not sure of what the parameter order was for 9147. But for the most current build (9256) the command would be ...
lnBytes=CursorToXML(mcInputFile, mcOutputFile,3,512,"1")
... where mcInputFile is the file name, mcOutputFile is the file name, 3 means Raw format, 512 means mcOutputFile is a file name and not a variable and "1" means use an inline schema.
Cathy