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     [SOLVED]Define new fileds

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Define new fileds
 Login/Join
 
Member
posted
Hi all,

I am trying to define a new field and use it as ACROSS. What I am looking for is; first ACROSS section is the sales of model '2002 2 DOOR AUTO', second ACROSS section is the sales of all 'BMW' brand cars, which should include the sales of '2002 2 DOOR AUTO', and the last ACROSS column would be the sales of all CAR, which should include sales of 'BMW' and '2002 2 DOOR AUTO'.

I started to define them using the standard IF, THEN, ELSE statement as below:

DEFINE FILE IBISAMP/CAR
Model_Brand_AllCar/A30=IF MODEL EQ '2002 2 DOOR AUTO' 
THEN '2002 2 DOOR AUTO' 
ELSE IF CAR EQ 'BMW' 
THEN 'BMW' ELSE 'xALL CAR';
END
TABLE FILE IBISAMP/CAR
SUM SALES
BY COUNTRY
ACROSS Model_Brand_AllCar AS 'SALES'
ON TABLE SUMMARIZE
END 


But using this code the sales of 'xALL CAR' will exclude sales of 'BMW' and sales of 'BMW' will exclude sales of '2002 2 DOOR AUTO'

Then I tried to define 3 different new fields and have 3 ACROSS as below, but it still doesnt seem to work.

DEFINE FILE IBISAMP/CAR
 v_MODEL/A30=IF MODEL EQ '2002 2 DOOR AUTO' THEN '2002 2 DOOR AUTO' ELSE IF MODEL EQ 'XYZ' THEN 'XYZ';
 v_BRAND/A30=IF CAR EQ 'BMW' THEN 'BMW' ELSE IF MODEL EQ 'XYZ' THEN 'XYZ';
 v_AllCar/A30= IF SALES NE 0 THEN 'ALL CAR' ELSE 'XYZ'
 END
TABLE FILE IBISAMP/CAR
SUM SALES
BY COUNTRY
ACROSS v_AllCar AS ''
ACROSS v_BRAND AS ''
ACROSS v_MODEL AS ''
ON TABLE SUMMARIZE
END 


Does anyone have a solution to what I am looking for?

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


WebFOCUS 7.7.02
Windows, All Outputs
 
Posts: 20 | Registered: June 12, 2012Report This Post
Virtuoso
posted Hide Post
Problem is that ACROSS divides a population, so any data instance included in the report will contribute to only one column. Nothing gets double-counted. What you want requires that one model be triple-counted, and all other BMW models double-counted.

So, if you want to use ACROSS syntax, you have to pre-compute the sum for each bin.

Here's one way...
SET ASNAMES = ON
DEFINE FILE CAR
BIN1/A1='1';
BIN2/A1='2';
BIN3/A1='3';
END

TABLE FILE CAR
SUM SALES BY COUNTRY BY BIN1 AS BIN
WHERE MODEL EQ '2002 2 DOOR AUTO' ;
ON TABLE HOLD AS HOLD1
RUN
SUM SALES BY COUNTRY BY BIN2 AS BIN
WHERE CAR EQ 'BMW';
ON TABLE HOLD AS HOLD2
RUN
SUM SALES BY COUNTRY BY BIN3 AS BIN
ON TABLE HOLD AS HOLD3
END

TABLE FILE HOLD1
SUM SALES BY COUNTRY BY BIN
ON TABLE HOLD AS HOLD4
MORE
FILE HOLD2
MORE
FILE HOLD3
END

TABLE FILE HOLD4
SUM SALES 
BY COUNTRY
ACROSS BIN
ON TABLE SUMMARIZE
END


The same can be accomplished in fewer steps using "McGuyver".
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
Using McGuyver technique:

EX MAKESEQ FIRST=1,LAST=3,COUNTER=BIN
JOIN CLEAR *
JOIN BLANK WITH SALES IN CAR TO BLANK IN FSEQ

DEFINE FILE CAR
BLANK/A1 WITH SALES =;
XSALES/D12.2 =
IF (BIN EQ 1 AND MODEL EQ '2002 2 DOOR AUTO')
OR (BIN EQ 2 AND CAR EQ 'BMW')
OR (BIN EQ 3)
 THEN SALES
 ELSE 0;
END

TABLE FILE CAR
SUM XSALES AS SALES
BY COUNTRY ACROSS BIN
WHERE BIN FROM 1 TO 3 ;
ON TABLE SUMMARIZE
END


===> (See this post for makeseq.fex) <===

This message has been edited. Last edited by: j.gross,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
Thank you j.gross! That is exactly what I was looking for.

I tried to use the McGyver technique but I got the following error message,

ibi.webfoc.wfmre.mrutil.WFMRError: E:\ibi\WebFOCUS77\basedir\MAKESEQ.fex (The system cannot find the file specified)

Guess I am missing a file or something to use that technique.

I will use the long and complicate one instead hehe.


WebFOCUS 7.7.02
Windows, All Outputs
 
Posts: 20 | Registered: June 12, 2012Report This Post
Virtuoso
posted Hide Post
SEE ABOVE
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
You just need to create an FSEQ file. It will come in handy to have it.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Member
posted Hide Post
Got it!

Thank you all for your helps!


WebFOCUS 7.7.02
Windows, All Outputs
 
Posts: 20 | Registered: June 12, 2012Report 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     [SOLVED]Define new fileds

Copyright © 1996-2020 Information Builders