Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Is it possible to dynamically assign an AS title to a field?
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Is it possible to dynamically assign an AS title to a field?
 Login/Join
 
Member
posted
Hello,
I am currently trying to design a report in InfoAssist that will dynamically assign a title based on the result of an IF statement.

Example:

DEFINE FILE EXAMPLEFILE
define/A10=IF ClusterX.TableX.FieldX EQ 'A' THEN ClusterX.TableY.FieldY ELSE ClusterX.TableX.FieldX;
END
.
.
.
TABLE FILE EXAMPLEFILE
BY define AS (IF FieldY was select then the title of field "Y" else if FieldX was selected then the tile of field "X")
END


Another idea that I had would be to display both fields and hide one of them based on the result of the if statement

Example:

DEFINE FILE EXAMPLEFILE
define/A10=IF ClusterX.TableX.FieldX EQ 'A' THEN ClusterX.TableY.FieldY ELSE ClusterX.TableX.FieldX;
END
.
.
.
TABLE FILE EXAMPLEFILE
BY ClusterX.TableX.FieldX AS "X" (IF FieldY was select then add NOPRINT else if FieldX was selected then display this field)
BY ClusterX.TableY.FieldY AS "Y" (IF FieldX was select then add NOPRINT else if FieldY was selected then display this field)

END

I'm not having any luck with getting either of these to work. I'm not even sure if either of these are possible or if someone has another possible solution that would solve my problem but I would appreciate any advice on how to possibly do this!

The current version that I am running on is 8205 gen number 78.

Thanks,
Alex

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 8 | Registered: June 19, 2018Reply With QuoteReport This Post
Virtuoso
posted Hide Post
AFAIK it's not possible.
You can use a variable such as :
BY ABC AS '&ABCTTL'

But the column title will remain the same for the whole column

One thing that can be done which is "sort of" dynamic, is the following
SET ASNAMES = ON
-SET &CNTRY = 'ENGLAND';
DEFINE FILE CAR
RG_TITLE /A10 = DECODE COUNTRY ('ENGLAND' 'G.-B.' 'JAPAN' 'Asia' ELSE 'Europe');
END
TABLE FILE CAR
BY RG_TITLE
WHERE COUNTRY EQ '&CNTRY';
ON TABLE HOLD AS REGTTL
END
-RUN
-READFILE REGTTL

TABLE FILE CAR
SUM SEATS
BY COUNTRY AS '&RG_TITLE'
BY CAR
WHERE COUNTRY EQ '&CNTRY';
END
-RUN


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2223 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
I'll give that a try Martin.
Thank you for the information and the suggestion!
 
Posts: 8 | Registered: June 19, 2018Reply With QuoteReport This Post
Master
posted Hide Post
Not sure if this is exactly what you are looking for, but you can put in a parameter for a a field and prompt for a selection of the field that you want in the report.
  
TABLE FILE car
SUM &MEASURE.( <SALES,SALES AS 'Sales'>,<RETAIL COST,RETAIL_COST AS 'Retail,Cost'>,<DEALER COST,DEALER_COST AS 'Dealer,Cost'>).Select Metric.
BY &DIMENSION.( <COUNTRY,COUNTRY AS 'Country'>,<CAR,CAR AS 'Car'>,<MODEL,MODEL AS 'Model'>).Select Dimension.
ON TABLE SET PAGE-NUM OFF 
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/flat.sty,$
ENDSTYLE
END

-RUN


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 485 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Is it possible to dynamically assign an AS title to a field?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.