Focal Point
[SOLVED] Fully Qualified Field Names in EXCEL Output

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

July 09, 2015, 03:59 PM
Pa_ul
[SOLVED] Fully Qualified Field Names in EXCEL Output
I am working in WebFOCUS Developer Studio 8.1.

I have created a report in Excel 2007 format.

The report is based on data as follows:

Table Name: PERSON

Column Names: FIRST_NAME
LAST_NAME

My report shows column headings as follows:

FIRST_NAME LAST_NAME

I would like them to appear as follows:

PERSON.FIRST_NAME PERSON_LAST_NAME

I can I do this?

Thank you.

Paul.

This message has been edited. Last edited by: <Kathryn Henning>,
July 09, 2015, 04:44 PM
Francis Mariani
There does not appear to be a way to force fully qualified field names in report output. There is a SET command that provides a qualified field name, but only if two or more fields with the same name are retrieved from different segments.

quote:

QUALTITLES - The QUALTITLES parameter uses qualified column titles in report output when duplicate field names exist in a Master File. A qualified column title distinguishes between identical field names by including the segment name.

The syntax is:

SET QUALTITLES = {ON|OFF}

where:

ON - Uses qualified column titles when duplicate field names exist and FIELDNAME is set to NEW.

OFF - Disables qualified column titles. OFF is the default value.


I have a feeling your only choice is to hard-code the field names:

...
PRINT 
COUNTRY AS 'CAR.COUNTRY'
...



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 09, 2015, 05:22 PM
Pa_ul
Francis:

Thank you for your response.

You have confirmed what my research revealed!

Paul.
July 17, 2015, 03:57 PM
sh98110
Folks, I wanted to post an outline for a “real” (as opposed to ‘I just gave up’) solution to this issue, in the hope that the next person that has this needs finds these thoughts useful (or more likely, someone on the forum has a more efficient method to offer up).
Caveats:
1. this simple approach requires a single fieldname per line, but should be able to be easily extended;
2. this example also only shows a –TYPE of the new focexec code for demonstration. For actual use, change to –WRITE for your appropriate operating system.

Step One: original procedure-

TABLE FILE Car
PRINT           
MODEL           
BY              
COUNTRY         
END   


Step Two: grab the qualified field names for your master. REMINDER: if this is using a JOIN structure, be sure to issue the JOIN PRIOR to issuing the CHECK command.
CHECK FILE CAR HOLD                                       
TABLE FILE HOLD                                           
PRINT FIELDNAME                                           
COMPUTE                                                   
SNAME/A60=SQUEEZ(60, (SEGNAME||'.'||FIELDNAME), 'A60');   
ON TABLE SET HOLDLIST PRINTONLY                           
ON TABLE HOLD FORMAT ALPHA AS FULLYQ                      
END



Without the HOLD command, the following output is produced:

COUNTRY     ORIGIN.COUNTRY
CAR         COMP.CAR  
MODEL       CARREC.MODEL
BODYTYPE    BODY.BODYTYPE


… and so on.

Step Three: run the following code to –READ the original procedure and TYPE out (or –WRITE out, in the real world) a MODIFIED procedure with fully qualified column names.

DYNAM ALLOC DDNAME FEXIN DSNAME X3HK.PDS.FOCEXEC(NONQ) SHR REUSE
-*                                                              
-TOPPER                                                         
-READ FEXIN, &LINE.A80.                                         
-IF &IORETURN NE 0 THEN GOTO BYBY ;                             
-SET &TEST = DECODE &LINE (FULLYQ ELSE 1);                      
-IF &TEST EQ 1 THEN GOTO NOT_OBJECT;                            
-SET &NEWLINE = DECODE &LINE (FULLYQ ELSE 0);                   
-TYPE &LINE AS &NEWLINE
-GOTO TOPPER                                                    
-NOT_OBJECT                                                     
-TYPE &LINE                                                     
-GOTO TOPPER                                                    
-*                                                                
-BYBY                                                           
-EXIT




Running the above procedure against the original code (in step three, be sure to change the DYNAM to the appropriate FILEDEF or APP FI for your shop) generates the following output:


TABLE FILE CAR     
PRINT              
MODEL              
 AS CARREC.MODEL   
BY                 
COUNTRY            
 AS ORIGIN.COUNTRY 
END




Again, my goal here is just to help out the next person, who doesn’t want to go through this process one column at a time for a lot of different procedures. Yes, this is a lot of work if you just have one focexec with just a few fields; however, I hope that if you have MANY focexecs and MANY columns, that the above will serve as a useful starting point.

Of course, there is always the possibility that IBI will create this feature as an NFR:

SET TITLE=FULLQ UAL

would be my suggestion.


WebFOCUS 8
Windows, All Outputs