Subject:Save results of XQuery as CSV? Author:Tony Lavinio Date:28 Sep 2006 01:49 AM
Instead of sending the output to a file with a name like this:
file:///c:/myfile.txt
try something like this:
adapter:CSV?file:///c:/myfile.txt
That will pipe the output through the CSV adapter, turning the first
level of elements under the root into lines, and the second level of
elements under the root into comma-separated fields of data.
Subject:Save results of XQuery as CSV? Author:Doug Lundin Date:28 Sep 2006 10:52 AM
I've been tinkering with this and can't seem to get it to work. Perhaps I'm making this change in the wrong place. I've got Stylus Enterprise opened with my xquery loaded. I open my scenario and when the Output URL is set to file:///c:/myfile.txt I get the expected output. When I change it to adapter:CSV?file:///c:/myfile.txt I get an empty file.
Subject:Save results of XQuery as CSV? Author:Tony Lavinio Date:29 Sep 2006 12:23 AM
Can you attach a sample of the XML you get after transforming
when you aren't using the adapter? You can email it to
stylus-field-report (at) progress.com, or attach it here, and
we'll take a look.
Subject:Save results of XQuery as CSV? Author:Tony Lavinio Date:03 Oct 2006 11:03 AM
I think you need one more level of element in your output.
In order to write through the CSV adapter, you need a root
element, and then a row element, and then column elements.
I tried a simple XQuery program that consisted of just this:
<CompanyMetadata><Col1>44,093,500</Col1><Col2>11.75</Col2></CompanyMetadata>
and I got just a CR/LF in my output file. The reason? No
root element - Stylus Studio just saw CompanyMetadata as the
root, and Col1 and Col2 as row names.
If I change it to
<CompanyMetadata><Row><Col1>44,093,500</Col1><Col2>11.75</Col2></Row></CompanyMetadata>
then I get
"44,093,500",11.75
as my output.
Here is the output URL I used:
adapter:CSV?file:///c:/temp/lundin.txt