[RESOLVED]How to Create XML Header for procedure output to be used in fusion charts?
hi guys,
i create Fex procedure that produced data in XML format, i generate the entire document except the header it is not being generated when i use -WRITE dialog manager code. also i cant aggregate the data to be appear once also, is it possible to be grouped under sub element?
my code and the output as following.
-* File writexml2.fex
APP FI MYXML2 DISK BASEAPP/MYXML2.XML
-RUN
-WRITE MYXML2 <chart caption=Retail Info By Country subcaption=Info About Cars xAxisName=Country yAxisName=Retail Coast numberPrefix=$>
-RUN
DEFINE FILE CAR
CRLF/A1=HEXBYT(10,'A1');
-*XML_CHARTS/A150='<chart caption=''Retail Info By Country'' subcaption=''Info About Cars'' xAxisName=''Country'' yAxisName=''Retail Coast'' numberPrefix=''$''>';
-*XML_CHARTE/A8='</chart>';
VALUEDATA/A10=PTOA(CAR.BODY.RETAIL_COST, '(P8.2)', VALUEDATA);
XML_LABEL/A200='<set label= '||''''||COUNTRY||''''||' value='|| '''' || VALUEDATA ||''''||'/>';
END
TABLE FILE CAR
PRINT
CRLF
XML_LABEL CRLF
ON TABLE SAVE AS MYXML2
END
-WRITE MYXML2 </chart>
-RUN
-END
We are missing quite a bit of your post but a couple of notes.
1. I don't see a -WRITE in your posted code. 2. If you want to append to a file, include (APPEND to the end of your filedef. 3. You can use SUM and BY to group things in your TABLE request.
and make sure that you have a -RUN after your TABLE FILE END and before your -WRITE.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
March 23, 2010, 04:19 AM
Qalqili
Hi Waz
it work perfect for first time , in second time it appended on the old file because of Append mod. kindly can you help me if i want to regenerate the file from scratch every time when i run the procedure. or if i can delete the file first by issuing os command or dos command at the header of the procedure then generate again from scratch will be greate for me.
Thanks in Advance QalqiliThis message has been edited. Last edited by: Qalqili,
Instead of issueing a DOS DEL, how about using the original APP FI, then reissue it with the append.
-* File writexml2.fex
APP FI MYXML2 DISK BASEAPP/MYXML2.XML
-RUN
-WRITE MYXML2 <chart caption=Retail Info By Country subcaption=Info About Cars xAxisName=Country yAxisName=Retail Coast numberPrefix=$>
-RUN
APP FI MYXML2 DISK BASEAPP/MYXML2.XML (APPEND
-RUN
DEFINE FILE CAR
CRLF/A1=HEXBYT(10,'A1');
-*XML_CHARTS/A150='<chart caption=''Retail Info By Country'' subcaption=''Info About Cars'' xAxisName=''Country'' yAxisName=''Retail Coast'' numberPrefix=''$''>';
-*XML_CHARTE/A8='</chart>';
VALUEDATA/A10=PTOA(CAR.BODY.RETAIL_COST, '(P8.2)', VALUEDATA);
XML_LABEL/A200='<set label= '||''''||COUNTRY||''''||' value='|| '''' || VALUEDATA ||''''||'/>';
END
TABLE FILE CAR
PRINT
CRLF
XML_LABEL CRLF
ON TABLE SAVE AS MYXML2
END
-RUN
-WRITE MYXML2 </chart>
-RUN
-END
The first -WRITE will overwrite the file, then it just appends.