Focal Point
[CLOSED] Is it possible to dynamically assign an AS title to a field?

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

November 01, 2019, 12:09 PM
AlexB
[CLOSED] Is it possible to dynamically assign an AS title to a field?
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,
November 01, 2019, 04:20 PM
MartinY
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.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 04, 2019, 10:27 AM
AlexB
I'll give that a try Martin.
Thank you for the information and the suggestion!
November 04, 2019, 01:00 PM
Hallway
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

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs: