NetTalk Central

Author Topic: xFiles - Exporting Queues to xml that can be opend by spreadsheet  (Read 3645 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Hi, Bruce

For several years I have been using a couple of custom procedures to view the contents of queues and memory tables in a spreadsheet.  These were based on a Clarion Magazine article written by Carl Barnes (thanks, Carl).  These work fine but I thought I could reduce complexity using xFiles instead.   An xml file with the data is successfully generated, but Excel and LibreCalc choke on it because of "Reference to undeclared namspace prefix.." then the queue or mem table prefix.

I couldn't find a reference either to the task or the problem in the documentation or discussion about xFiles, so how is this done.  If it is more than a setting or parameter or two, I would be happy to ask at the next User Group. 

Thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: xFiles - Exporting Queues to xml that can be opend by spreadsheet
« Reply #1 on: February 07, 2022, 09:58:10 PM »
Hi Casey,

Tell me more about how you are creating the XML. Using the xFilesXML class? or the xCell class?
what does your code look like, and perhaps post an example of your output?

Cheers
Bruce

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: xFiles - Exporting Queues to xml that can be opend by spreadsheet
« Reply #2 on: February 08, 2022, 11:02:01 AM »
The code is dead simple

The prototype:
(Queue p:Q, <String p:Filename>, <String p:Format>) ,String ,Proc

Data section:

LocalXML  xFileXML


Code in question:
!------------------------------------------------------------------
  IF ~Records(p:Q)
    RetVal = 'Queue is empty. No export file produced.'
    DO ReturnRoutine
  END
  N_ExportQFile = choose(~p:Filename, 'ExportQ.xml', p:Filename)
  IF ~p:FileName                        ! prompt for a filename if not already provided
    if ~FileDialog('Export Queue to file ...', N_ExportQFile, 'XML files (*.xml)|*.xml', 10011b)
      RetVal = 'File Selection Cancelled'
      DO ReturnRoutine
     end
  END 
  LocalXML.start()
  LocalXML.Save(p:Q, N_ExportQFile)
  RetVal = 'Completed'
  DO ReturnRoutine

The output is attached as a txt.

Thanks, Bruce.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: xFiles - Exporting Queues to xml that can be opend by spreadsheet
« Reply #3 on: February 10, 2022, 08:50:33 PM »
You mustn't have a prefix in your xml.
So
LocalXml.RemovePrefix = true

You might also want to look at https://www.capesoft.com/docs/xFiles/xfiles.htm#xCellClass

This allows you to construct an actual spreadsheet xml file.

Cheers
Bruce