Focal Point
SOLVED: Define: across fields

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

March 05, 2013, 09:27 AM
Kathy P
SOLVED: Define: across fields
When I sum extdollars across by salesmonth, hold, then define against the hold file, the across extdollars for each salesmonth does not show up in the GUI as fields. Does anyone know why? I find this very strange. I can table the hold file and see everything. Thank you in Advance

This message has been edited. Last edited by: Kathy P,


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows
March 06, 2013, 08:52 AM
George Patton
I sort of hate to say this, but once you get involved with hold files ans subsequent defines it's MUCH easier to just hand-code everything.

I guess most of us old-timers think hand-coding is the only way to go anyway, although Information Builders seems hellbent on making us hang up our keyboards ....


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
March 06, 2013, 08:55 AM
George Patton
I just noticed something else. ACROSS doesn't work with HOLD files. You need to use BY.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
March 07, 2013, 03:06 AM
Dave
Kathy,

This is by design ( I think ).

When you use ACROSS to make columns with the available data, there is no way of knowing how many columns will be available in the HOLD. That's probably why the GUI doesn't show the columns.

What WF does for you is create 'new' columns names.

See this example:
TABLE FILE CAR
	SUM 	SALES
	BY	COUNTRY
	ACROSS	SEATS
ON TABLE HOLD AS DEMO FORMAT FOCUS
END

?FF DEMO 


You'll see the hold contains 3 'sales' fields:
SAL2 ( for 2 seats )
SAL4 ( for 4 seats )
SAL5 ( for 5 seats )

The across-field-value is added to the name of the column as a suffix. But why SALES becomes SAL, I don't know.

( SET ASNAMES = ON/OFF changes this behaviour. )

You could also use the relative column names, that works all the time.

E01 being the first column
E02 being the second, etc.



Or use BY-fields in the HOLD and use ACROSS only in the actuall report like George Patton ( Is that your real name..., really ? ) suggests.


G'luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
March 07, 2013, 10:05 AM
Davmayf44
ACROSS will work with hold files...after the hold do a ?ff to see what field names were generated (the E01...En) then re assign names in a defind for further use...this is very useful when trying to move values form a list down to columns across....


WebFOCUS 7.6
Windows, All Outputs
March 07, 2013, 10:58 AM
Francis Mariani
SET ASNAMES=ON is very important when creating a HOLD file with ACROSS. You may be able to turn this on using the GUI.

Meanwhile, I am not GUIfied, so I would be playing around with stuff like this...

TABLE FILE CAR
SUM
SALES
ACROSS COUNTRY
ON TABLE HOLD AS H001
END

Without SET ASNAMES=ON you get 5 fields names SALES (with aliases E01, E02, E03...).

With SET ASNAMES=ON you get 5 fields, named SALENGLAND, SALFRANCE, SALITALY, SALJAPAN and SALW GERMANY. To refer to the last field, because is has a space, you can use 'SALW GERMANY'.

To determine what the HOLD file field names are, you could run this:

CHECK FILE H001 HOLD
-RUN

TABLE FILE HOLD
PRINT FIELDNAME
-*ON TABLE HOLD AS H002
END


A complete program:
SET HOLDFORMAT=ALPHA
SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM
SALES
ACROSS COUNTRY
ON TABLE HOLD AS H001
END
-RUN

CHECK FILE H001 HOLD
-RUN

TABLE FILE HOLD
PRINT 
COMPUTE FIELD_NAME/A80 = '''' || FIELDNAME || '''';
ON TABLE HOLD AS H002
END
-RUN

TABLE FILE H001
PRINT
-INCLUDE H002
END
-RUN



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
March 12, 2013, 04:48 PM
Kathy P
Hi, thank you everyone for your input. The client wants to support her reports in the GUI as much as possible. I know both ways. Some things I prefer the GUI, somethings I prefer to code. I concluded ACROSS is really for the final output stage. My client has an across field with many more columns to be computed and added and they do use some of the across fields. I ended up creating buckets for each of the across fields. Thanks


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows