Focal Point
[RESOLVED]How to Create XML Header for procedure output to be used in fusion charts?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/898106004

March 22, 2010, 10:04 AM
Qalqili
[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


output as following
  
<set label='ENGLAND' value=' 8878.00'/>
<set label='ENGLAND' value='13491.00'/>
<set label='ENGLAND' value='17850.00'/>
<set label='ENGLAND' value=' 5100.00'/>
<set label='JAPAN' value=' 3139.00'/>
<set label='JAPAN' value=' 3339.00'/>
<set label='ITALY' value=' 5925.00'/>
<set label='ITALY' value=' 6820.00'/>
<set label='ITALY' value=' 6820.00'/>
<set label='ITALY' value='31500.00'/>
<set label='W GERMANY' value=' 5970.00'/>
<set label='W GERMANY' value=' 5940.00'/>
<set label='W GERMANY' value='6355.00'/>        
<set label='W GERMANY' value='13752.00'/>
<set label='W GERMANY' value='14123.00'/>
<set label='W GERMANY' value=' 9097.00'/>
<set label='W GERMANY' value=' 9495.00'/>
<set label='FRANCE' value=' 5610.00'/> 



i am expecting the output as following:-

 
<chart caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'>
<set label='ENGLAND' value=' 8878.00'/>
<set label='ENGLAND' value='13491.00'/>
<set label='ENGLAND' value='17850.00'/>
<set label='ENGLAND' value=' 5100.00'/>
<set label='JAPAN' value=' 3139.00'/>
<set label='JAPAN' value=' 3339.00'/>
<set label='ITALY' value=' 5925.00'/>
<set label='ITALY' value=' 6820.00'/>
<set label='ITALY' value=' 6820.00'/>
<set label='ITALY' value='31500.00'/>
<set label='W GERMANY' value=' 5970.00'/>
<set label='W GERMANY' value=' 5940.00'/>
<set label='W GERMANY' value='6355.00'/>        
<set label='W GERMANY' value='13752.00'/>
<set label='W GERMANY' value='14123.00'/>
<set label='W GERMANY' value=' 9097.00'/>
<set label='W GERMANY' value=' 9495.00'/>
<set label='FRANCE' value=' 5610.00'/> 
</chart>
 


i appreciate your help all of you.

Regards
Qalqili

This message has been edited. Last edited by: Qalqili,


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
March 22, 2010, 10:41 AM
GinnyJakes
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.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
March 22, 2010, 11:27 AM
Tony A
Something else to be aware of is when to use -RUN.

You need the one after the FILEDEF but you would also need one after the table request if you plan on writing to the file again.

There are many posts on appending to files if you search for then and they contain many tips and hints on what needs to go where.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 22, 2010, 04:35 PM
Waz
Qalqili, looks like you pasted HTML code in the Quote.

You should be able to just post the HTML.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 23, 2010, 12:26 AM
Qalqili
i am sorry guys for missing code , i update my posted code,

i tried with APPEND but it is not recognize in dialog manager may be 76.10 not recogonize
the -APPEND command.


i appreciate your help
Regards
Qalqili


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
March 23, 2010, 12:44 AM
Waz
Change the APP FI to
APP FI MYXML2 DISK BASEAPP/MYXML2.XML (APPEND

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.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs: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
Qalqili

This message has been edited. Last edited by: Qalqili,


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
March 23, 2010, 04:39 AM
Qalqili
My Friend WAZ

i found it i search in dialog manager documentation and i found -DOS command it work very perfect.

-DOS del C:\ibi\apps\baseapp\MYXML2.XML
-RUN

Many thanks for all of you.
Regards
Qalqili


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
March 23, 2010, 04:27 PM
Waz
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.

It also removes those pesky OS calls.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!