Focal Point
[SOLVED] Use DOS command to generate XML file listing

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

February 02, 2017, 11:08 AM
Squatch
[SOLVED] Use DOS command to generate XML file listing
I would like to create a FEX file that uses a DOS command to generate a listing of data files from a WebFOCUS reporting server. The files would correspond to the files found under EDASERVE in a particular folder.

My end goal is to use the file listing to populate an HTML select control with filename choices. So the FEX would output the list of files in XML format.

So here are some data files under EDASERVE in a folder called "csv" under the main folder "sankey":

(Windows DOS command on WebFOCUS server...)

E:\>DIR E:\ibi\apps\sankey /b /s

(Result...)

E:\ibi\apps\sankey\csv\sankey_data_1.csv
E:\ibi\apps\sankey\csv\sankey_data_2.csv
E:\ibi\apps\sankey\csv\sankey_data_3.csv
E:\ibi\apps\sankey\csv\subfolder\sankey_data_4.csv

Ideally, my HTML application would populate a select box with the following choices based on the XML with the above filenames in it:

(Select control choices...)

sankey_data_1.csv
sankey_data_2.csv
sankey_data_3.csv
subfolder/sankey_data_4.csv

The HTML application would then use a D3 javascript library to load the selected CSV file's data to generate a Sankey diagram. I just need the relative path folder/filename XML info from the FEX.

Anybody done anything like this before?

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


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 02, 2017, 11:52 AM
David Briars
Instead of DOS, can you try the WF APP command?:
APP QUERY IBISAMP HOLD
-RUN
TABLE FILE FOCAPPQ
PRINT FILENAME
IF FILENAME CONTAINS '.fex'
END 

or
TABLE FILE _EDAHOME/CATALOG/SYSAPPS 
PRINT APPLOC
      FNAME
      FEXT
IF APPNAME EQ ibisamp
IF FEXT EQ fex
END  

This message has been edited. Last edited by: David Briars,
February 02, 2017, 01:43 PM
Squatch
Thanks, David. That's close. I need something that will report on *.txt or *.csv files that are in subfolders as well.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 02, 2017, 02:02 PM
Squatch
Hey, David, I found that this is good enough:

APP QUERY SANKEY/CSV HOLD
-RUN
TABLE FILE FOCAPPQ
PRINT FILENAME
ON TABLE PCHOLD FORMAT XML
END

This retrieves any filename in folder "csv" under "sankey" in EDASERVE. That is good enough, as I'm requiring my two users of this application to put their data in the "csv" folder.

Thanks for the quick response!


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 02, 2017, 04:35 PM
Squatch
I was able to populate an HTML select control with a list of filename choices residing in a particular folder under EDASERVE.

The HTML app with the control then launches another HTML app and passes it a filename; the second HTML app uses that file as a data source for creating a Sankey chart.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
February 07, 2017, 09:42 AM
TexasStingray
SHARING:

AS A FORMER IBI'er I WOULD RECOMMEND DISABLING THE USE OF THE DOS (!) COMMAND. I WILL NOT GO INTO DETAIL BUT USE THEM AT YOUR OWN RISK AS THEY ARE A SECURITY RISK.

INSTEAD WHAT I WOULD DO AND HAVE DOME IS CREATE A PROGRAM THAT CAN BE CALLED WITH CALLPGM OR CALLJAVA THEY WAY THEY CANNOT DO SOMETHING THEY SHOULD NOT DO.




Scott