Focal Point
How to use variable as fieldname? or put current date on report [SOLVED]

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

April 30, 2014, 04:59 PM
Josh K
How to use variable as fieldname? or put current date on report [SOLVED]
I have a report in which I have the current date stored in a variable, and I want to include it as field on the report. I tried this:

-SET &WORKDATE = AYMD(&YYMD,0,'I8YYMD') ;
-SET &SAVEDATE=EDIT(&WORKDATE,'99999999$');
.....
.....
BY
	'&SAVEDATE'  AS 'Date Rpt Run'


I also tried:

BY
	&SAVEDATE  AS 'Date Rpt Run'


Both give me
 (FOC003) THE FIELDNAME IS NOT RECOGNIZED: 20140430
    BYPASSING TO END OF COMMAND


What is the proper syntax for including a variable in the report? Output of the report is Excel, if that matters.

This message has been edited. Last edited by: Josh K,


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
April 30, 2014, 05:35 PM
jfr99
Hi Josh,

Does this help?

-*
-SET &WORKDATE = AYMD(&YYMD,0,'I8YYMD') ;
-*
DEFINE FILE CAR
RUN_DATE1/MDYY = &MDYY;
RUN_DATE2/YYMD = &WORKDATE;
END
-*
TABLE FILE CAR
HEADING
"WORKDATE = &WORKDATE "
" "
PRINT
RUN_DATE1
RUN_DATE2 AS 'Date Rpt Run'
BY COUNTRY
ON TABLE PCHOLD FORMAT EXL07
END


WebFocus 8.201M, Windows, App Studio
April 30, 2014, 05:38 PM
Waz
Josh, I assume this is a static value to be shown in the report.

If so you need to define the field first.

DEFINE FILE CAR
 SAVEDATE/I8 = &YYMD ;
END 
TABLE FILE CAR
PRINT MODEL
BY SAVEDATE
BY COUNTRY
BY CAR
END  



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 30, 2014, 05:51 PM
Josh K
Thanks!


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)