Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Question on another twist for Across

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Question on another twist for Across
 Login/Join
 
Silver Member
posted
I'm trying to create a report that looks like this:

CAR Dealer Cost Retail Cost
England France Italy England France Italy
Alpha Romeo
Jaguar
Peugeot

The code that I have below is putting the country on top of the costs.

TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
BY CAR
ACROSS COUNTRY
ON TABLE NOTOTAL
END

Is this even possible?


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
 
Posts: 34 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Joel,
From your example it is hard to understand what you want to achieve.
You have twice across "England France Italy"
Under CAR you have "Alpha Romeo", "Jaguar", "Peugeot".
Could you be a bit more precise?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Silver Member
posted Hide Post
I don't know if this will show up correctly on this forum.

The output of the above code shows like this:

ENGLAND FRANCE ITALY
CAR DEALER_COST RETAIL_COST DEALER_COST RETAIL_COST DEALER_COST RETAIL_COST
ALFA ROMEO . . . . 16,235 19,565
JAGUAR 18,621 22,369 . . . .
JENSEN 14,940 17,850 . . . .
MASERATI . . . . 25,000 31,500
PEUGEOT . . 4,631 5,610 . .
TRIUMPH 4,292 5,100 . . . .


This is the output that I'd like to achieve:

CAR DEALER_COST RETAIL_COST
ENGLAND FRANCE ITALY ENGLAND FRANCE ITALY
ALFA ROMEO . . 16,235 . . 19,565
JAGUAR 18,621 . . 22,369 . .
JENSEN 14,940 . . 17,850 . .
MASERATI . . 25,000 . . 31,500
PEUGEOT . 4,631 . . 5,610 .
TRIUMPH 4,292 . . 5,100 . .


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
 
Posts: 34 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Like this?
CAR        DEALER_COST                      RETAIL_COST
           ENGLAND    FRANCE     ITALY      ENGLAND    FRANCE     ITALY
ALFA ROMEO          .          .     16,235          .          .     19,565
JAGUAR         18,621          .          .     22,369          .          .
JENSEN         14,940          .          .     17,850          .          .
MASERATI            .          .     25,000           .         .     31,500
PEUGEOT             .      4,631          .           .     5,610          .



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Silver Member
posted Hide Post
Yes Danny. That's the format I want to achieve.


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
 
Posts: 34 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Joel,

Here you are:
  
-* File Joel1.fex
DEFINE FILE CAR
DC/A12='DEALER_COST';
RC/A12='RETAIL_COST';
END
TABLE FILE CAR
SUM DC DEALER_COST RC RETAIL_COST
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND' OR 'FRANCE' OR 'ITALY';
ON TABLE SAVE AS JOEL
END
-RUN
FILEDEF JOELM DISK JOEL.MAS
-RUN
-WRITE JOELM FILENAME=JOEL    , SUFFIX=FIX
-WRITE JOELM SEGMENT=JOEL, SEGTYPE=S0
-WRITE JOELM FIELDNAME=COUNTRY, ALIAS=E01, USAGE=A10, ACTUAL=A10, $
-WRITE JOELM FIELDNAME=CAR, ALIAS=E02, USAGE=A16, ACTUAL=A16, $
-WRITE JOELM SEGMENT=CST, PARENT=JOEL,  OCCURS=VARIABLE
-WRITE JOELM FIELDNAME=CODE, ALIAS=E03, USAGE=A12, ACTUAL=A12, $
-WRITE JOELM FIELDNAME=COST, ALIAS=E04, USAGE=D7, ACTUAL=A07, $
-RUN
TABLE FILE JOEL
SUM COST
BY CAR
ACROSS CODE AS ''
ACROSS COUNTRY AS ''
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
You can avoid the Dialog Manager manipulation, by use of the McGuyver technique, as discussed in recent posts. The crux is to transform the Dealer Code and Retail Code captions from field-names into ACROSS sort values.

Essentially the technique uses a join to double the set of reportable records, and establishes a single DEFINEd numeric variable to hold values of DEALER_COST or RETAIL_COST, depending on a sort-key variable with "Dealer Code" and "Retail Code" as its values. Your report request will
SUM [the defined numeric field]
BY Car
ACROSS [the new key field] AS ''
ACROSS Country AS ''


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Silver Member
posted Hide Post
Jack stole my thunder, but here's the code I came up with:
JOIN BLANK WITH DEALER_COST IN CAR TO BLANK IN FSEQ

DEFINE FILE CAR
BLANK / A1 = ' ';
COST_TYPE/A11 = IF COUNTER EQ 1 THEN 'DEALER_COST' ELSE 'RETAIL_COST';
COST_AMOUNT/D7 = IF COUNTER EQ 1 THEN DEALER_COST ELSE RETAIL_COST;
END

TABLE FILE CAR
PRINT COST_AMOUNT
BY COUNTRY
BY CAR
BY COST_TYPE
WHERE COUNTER LE 2
ON TABLE HOLD
END

TABLE FILE HOLD
SUM COST_AMOUNT
BY CAR
ACROSS COST_TYPE
ACROSS COUNTRY
END


Jeff
WebFOCUS 8.0.09, Unix-Win-z/OS
FOCUS 7.3.1 on z/OS
 
Posts: 34 | Location: Minneapolis, MN | Registered: June 10, 2003Report This Post
Silver Member
posted Hide Post
Thanks Jack and Jeff. I will give this a shot!


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
 
Posts: 34 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
It's important to include a WITH anchor in the define of BLANK, corresponding to the anchor point of the JOIN.

I have my own utility fex to set up the McGuyver file:
  
-* File MakeSeq.fex
-DEFAULTH &FILE=FSEQ, &KEY=BLANK, &COUNTER=COUNTER, &FIRST=1, &LAST=100
 EX -LINES 7
 EDAPUT MASTER, &FILE, CV, MEM
  FILE=&FILE, SUFFIX=FOC, $
    SEGNAME=FSEQ1, SEGTYPE=S1, $
      FIELD=&KEY, , A1, ACCEPT=' ', INDEX=I, $
    SEGNAME=FSEQ2, SEGTYPE=S1, PARENT=FSEQ1, $
      FIELD=&COUNTER, , I4, $
 END
 CREATE FILE &FILE
 MODIFY FILE &FILE
  FREEFORM &KEY &COUNTER
  MATCH &KEY &COUNTER
    ON NOMATCH INCLUDE
    ON MATCH REJECT
 DATA
-REPEAT SEQ.LOOP FOR &I FROM &FIRST TO &LAST ;
 ' ', &I, $
-SEQ.LOOP
 END                     

The parameters allow the caller to tailor the range of Counter values stored in the focus file (and the filename and fieldnames as well).
The END line after the EX -LINES block is for clarity; it's harmless, and saves the day if the count is 1 over Wink

For the present case:

EX SESSION/CAR5

-* File CAR5.fex
EX BASEAPP/MAKESEQ FIRST=1,LAST=2,FILE=FOCSEQ,KEY=NADA

JOIN CLEAR *
JOIN NADA WITH DEALER_COST IN CAR TO NADA IN FOCSEQ

DEFINE FILE CAR
  NADA/A1 WITH DEALER_COST =;
  FIELD/A12 WITH COUNTER =
    DECODE COUNTER (
      1 'Dealer Cost'
      2 'Retail Cost'
    ELSE ' ');
  Value/D12.2 WITH COUNTER =
    IF COUNTER EQ 1 THEN DEALER_COST ELSE
    IF COUNTER EQ 2 THEN RETAIL_COST ELSE 0;
  Country/A10 =LCWORD(10,COUNTRY,'A10');
  Car/A16     =LCWORD(16,CAR,'A16');
END

TABLE FILE CAR
  SUM Value AS ''
  BY Car AS ''
  ACROSS COUNTER NOPRINT
  ACROSS FIELD AS ''
  ACROSS Country AS ''
  WHERE CAR IN ('ALFA ROMEO' 'JAGUAR' 'PEUGEOT');
END


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
Joel,

You can choose between 2 techniques.
Jack & Jeff propose the McGuyver
Mine is called "Alternate Master".

It is good to be acquainted with both.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Question on another twist for Across

Copyright © 1996-2020 Information Builders