Search code examples
webfocus

How do you use a variable as a field on a Webfocus report?


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.


Solution

  • How about you try

    -SET &BYTODAY = &YYMD;
    
    DEFINE FILE TABLE1
    BYDATE/I8YYMD = &BYTODAY;
    END
    TABLE FILE TABLE1
    ...
    BY BYDATE
    ...