> is throwing typ" /> > is throwing typ" /> > is throwing typ"/>

How to write KDB query output to a text file

78 Views Asked by At
filePath:hsym `$("/c/d/f/a.txt");
.co.fileHandle: hopen filePath;
x:select a,c from tab
neg[.co.fileHandle]  x

neg[.co.fileHandle] x >> is throwing type: Mismatched types errors

I am aware that I can directly save it as `:/c/d/f/x.txt. But, after writing query output to a.txt I want to add output of other queries also.

1

There are 1 best solutions below

1
Thomas Smyth - Treliant On BEST ANSWER

That only allows for a string or lists of strings to be appended to the file. Can use .Q.s to convert your table to strings.

q)neg[.co.fileHandle] .Q.s x

Can then verify the file contains the output

> cat /c/d/f/a.txt
a c
---
1 a
2 b
3 c