Two problems:
1) You are not copying the data from the static temp-table to the dynamic temp-temp table.
2) You are assigning the wrong handle to thand.
For PROCEDURE getColumnsToPrint, the BUFFER-CREATE, BUFFER-COPY and thand = needs to be:
Code:
CREATE TEMP-TABLE tth.
IF tb_testdate = TRUE THEN DO:
tth:ADD-NEW-FIELD("testdate","date").
END.
IF tb_testchar = TRUE THEN do:
tth:ADD-NEW-FIELD("testchar","CHARACTER").
END.
tth:TEMP-TABLE-PREPARE("tthh").
bh = tth:DEFAULT-BUFFER-HANDLE.
FOR EACH foo:
bh:BUFFER-CREATE().
bh:BUFFER-COPY(BUFFER foo:HANDLE).
END.
thand = tth.
Thank You for your reply.
I have called xmlspreadmultisheet.p instead of xmlspredsheet.p as advised by you.
It does not give any error. there are 2 files created now
as attached.
xmlspread.xml
11117
the file xmlspread.xml has only one line
the file 11117 is the correct file xmlfile. But the extension .xml is missing.
the file-name as a numeric and random. I do not have control over it.
If I run another time it gives another numeric number.
As I cannot upload files xmlspread.xml and 11117 (Extensions not allowed to be posted)
I have renamed both files as xmlspread.txt and 11117.txt
Where am I going wrong? Can you please help.
I would like to have control over the output file name.
I think you missed the procedure that transfers your database info to create an xml. Try this one:
Code:
DEFINE VARIABLE pHand AS HANDLE.
DEFINE VARIABLE thand AS HANDLE.
DEFINE VARIABLE hRows AS HANDLE.
DEFINE VARIABLE tth AS HANDLE NO-UNDO.
DEFINE VARIABLE bh AS HANDLE NO-UNDO.
CREATE TEMP-TABLE tth.
tth:ADD-NEW-FIELD("t_ItemNo","integer").
tth:ADD-NEW-FIELD("t_InvID","CHARACTER").
tth:TEMP-TABLE-PREPARE("tthh").
bh = tth:DEFAULT-BUFFER-HANDLE.
FOR EACH foo:
bh:BUFFER-CREATE().
bh:BUFFER-COPY(BUFFER foo:HANDLE).
END.
thand = tth.
RUN xmlspreadmultisheet.p PERSISTENT SET pHand.
RUN StartDocument IN pHand (
"c:\temp\test.xml"). /*where the xml file is located after it was created*/
RUN makeSheet IN pHand (
TABLE-HANDLE thand BY-REFERENCE, /* handle to temp-table */
TRUE, /* Include a header? */
"MySheet") . /* The name of the worksheet */
RUN endDocument IN pHand.
DELETE PROCEDURE pHand.
pHand = ?.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.