我想要一个非常简单的方法来查看正在进行的任何临时表中的内容吗?
答案 0 :(得分:2)
您也可以例如生成XML
tthTmp:WRITE-XML("FILE","c:\temp\tt.xml", TRUE).
或(可能不那么容易)输出为半冒号分隔文件
OUTPUT TO c:\temp\file.txt.
FOR EACH ttTmp:
EXPORT DELIMITER ";" ttTmp.
END.
OUTPUT CLOSE.
答案 1 :(得分:1)
我刚刚发现了一种使用Json(从10.2B开始)将临时表转储到文件的简单方法。 WRITE-JSON就是绝招!
DEFINE TEMP-TABLE ttTmp
FIELD FieldA AS CHAR
FIELD FieldB AS CHAR.
CREATE ttTmp.
ASSIGN ttTmp.FieldA = "A"
ttTmp.FieldB = "B".
DEFINE VARIABLE tthTmp AS HANDLE NO-UNDO. /* Handle to temptable */
DEFINE VARIABLE lReturnValue AS LOGICAL NO-UNDO.
tthTmp = TEMP-TABLE ttTmp:HANDLE.
lReturnValue = tthTmp:WRITE-JSON("FILE", "c:\temp\tthTmp.txt", TRUE, ?).
/* Output File tthTmp.txt
{"ttTmp": [
{
"FieldA": "A",
"FieldB": "B"
}
]}
Output File tthTmp.txt */