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     Column Headers derived from database field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Column Headers derived from database field
 Login/Join
 
Silver Member
posted
I'm working on a report in which the fields printed are determined by testing for a predetermined set of VARIABLEIDs, each of whose
column titles are retrieved from a database field associated with the VARIABLEID. The column titles are to be used in an AS phrase within the TABLE request, however, the object of the AS phrase has to be a literal or an Amper variable. So at the start, I'm isolating the selected variables and their associated title values in a hold file:

TABLE FILE GM_VARIABLE
PRINT
COMPUTE HVARIABLE /A50=SUBSTR(255,VARIABLEFORDISPLAY,1,40,40,'A40') || ' (' | EDIT(VARIABLEID) | ')';
TYPE
BY VARIABLEID
-*
WHERE VARIABLEID EQ 125018 OR 125019 OR 125069 OR 114009 OR 114008 OR
114001 OR 114002 OR 114003 OR 114004 OR 114005 OR
114006 OR 114007 OR 114014 OR 114011 OR 114016 OR
114015 OR 116015 OR 116014 OR 121006 OR 125060 OR
125061 OR 125062 OR 125063 OR 125064 OR 125045 OR
116001 OR 114012 OR 121001 OR 121002 OR 121003 OR
121004 OR 121005
ON TABLE HOLD AS HSTEP01
END
-RUN
Then I process each individual VARIABLEID to place the column title into an Amper variable:

TABLE FILE HSTEP01
PRINT HVARIABLE
WHERE VARIABLEID EQ 125018
ON TABLE HOLD AS V125018 FORMAT ALPHA
END
-RUN
-IF &LINES EQ 0 GOTO STEP02;

-READ V125018 &V125018.A50.
-RUN
-SET &V125018H = '''' || &V125018 || '''' || ',';
-RUN
And finally I'm able to refer to that Amper variable in the resulting report:

COMPUTE V125018Y1/D12S = IF VARIABLEID EQ '125018' AND YEAR EQ &YR_1 THEN VALUE ELSE 0; AS '&V125018H,&YR_1'
COMPUTE V125018Y0/D12S = IF VARIABLEID EQ '125018' AND YEAR EQ &YEAR THEN VALUE ELSE 0; AS '&V125018H,&YEAR'

The challenge I have concerns a fine print statement that says the program has to allow for 50 additional columns. These additional columns are to be entered via the launch page. I won't know ahead of time which ones they are, so my method of supplying the column titles for these variables has to be more automatic than the current method. Can anyone point me in the right direction? Thanks
 
Posts: 37 | Registered: November 22, 2005Report This Post
Virtuoso
posted Hide Post
Shot in the dark here, but what about using the origional table request to generate the entire compute statements, and hold the results in a .fex file. Then you can include the temp file in the final report ... thusly:

FILEDEF TOUT DISK tout.fex
TABLE FILE ...
PRINT
COMPUTE STUFF/A200 = 'COMPUTE V' | VARIABLEID | 'Y1/D12S = IF VARIALBEID EQ ' | '''' | VARIABLEID | '''' |
' AND YEAR EQ &|YEAR ... ; COMPUTE ... ';
BY VARIABLEID NOPRINT
WHERE VARIABLEID EQ 125018 OR 125019 OR 125069 ...
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS TOUT FORMAT ALPHA
END

TABLE FILE ...
PRINT
-INCLUDE TOUT
END

Would this do the trick?


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Silver Member
posted Hide Post
Thank you for contributing this solution. I tried it and it worked quite well. Thanks again.
 
Posts: 37 | Registered: November 22, 2005Report This Post
Expert
posted Hide Post
theres always
-SET &MYPARM = 'WHATS THIS?';
SET ASNAMES=ON
TABLE FILE CAR
HEADING
" &MYPARM "
SUM SALES AS '&MYPARM'
END
-RUN

you can plop &vars directly into headings
You can vary the formatting, too, using ITEM=
HEADING
" &MYPARM1 <+0> &MYPARM2 <+0> &MYPAR3 "
and in the style sheet
type=heading,line=1,item=1, style...whatever




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report 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     Column Headers derived from database field

Copyright © 1996-2020 Information Builders