Using Amper Variables as Parameter Values

When a parameterized report is scheduled, you can set the value of a parameter to a variable, rather than a literal value. This ability reduces the need for a schedule to be updated before it is run. For example, instead of editing a schedule daily in order to display up-to-date information, a report can be scheduled to always display the date of the day that it is running. This is done by setting the value of the parameter as &YYMD. In the Task Parameters dialog box, there is a check box labeled The value contains a system variable, as shown in the following image.

The Task Parameters dialog box. The the value contains a system variable check box is selected

This check box is cleared by default. When this check box is selected, a string beginning with the ampersand character is processed as a variable. When this check box is cleared, the ampersand character is then processed as a literal value. This feature works with both system variables, and global variables that have been set in the Reporting Server global profile edasprof.prf.

Example: Using the &YYMD Variable as a Parameter Value

The following syntax is a sample report procedure (FEX) that contains date parameter values that can be used with the &YYMD Variable.

-*COMPONENT=Define_wf_retail
DEFINE FILE retail_samples/wf_retail
Sale_Date/YYMD='&Sale_Date.Sale Date: Use &|YYMD in Schedules.' ;
 Last_Year/YYMD=Sale_Date - 365 ;
 Two_Years_Ago/YYMD=Last_Year - 365 ;
 Quantity/D12.2=IF WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Sale_Date THEN WF_RETAIL.WF_RETAIL_SALES.QUANTITY_SOLD ELSE 0 ;
 Prior_Year/D12.2=IF WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Last_Year THEN WF_RETAIL.WF_RETAIL_SALES.QUANTITY_SOLD ELSE 0 ;
 Two_Years_Past/D12.2=IF WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Two_Years_Ago THEN WF_RETAIL.WF_RETAIL_SALES.QUANTITY_SOLD ELSE 0 ;
END
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET SQUEEZE=ON
-DEFAULTH &WF_HTMLENCODE=ON;
SET HTMLENCODE=&WF_HTMLENCODE

SET HTMLCSS=ON
-DEFAULTH &WF_EMPTYREPORT=ON;
SET EMPTYREPORT=&WF_EMPTYREPORT

-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
TABLE FILE retail_samples/wf_retail
SUM Sale_Date AS 'Sale,Date'
Quantity AS 'Quantity Sold'
Last_Year AS 'Last,Year'
Prior_Year AS 'Quantity Sold,Last Year'
Two_Years_Ago AS 'Two,Years,Ago'
Two_Years_Past AS 'Quantity Sold,Two Years Ago'
BY WF_RETAIL.WF_RETAIL_GEOGRAPHY_STORE.BUSINESS_REGION
WHERE (WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Sale_Date) OR (WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Last_Year) OR (WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE EQ Two_Years_Ago);
ON TABLE SUBHEAD
"&Company.Company Name: Use Widgets&|More in Schedules."
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET CACHELINES 100
ON TABLE SET GRWIDTH 1
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, ORIENTATION=LANDSCAPE, HFREEZE=OFF, $
TYPE=TABHEADING, LINE=1, JUSTIFY=CENTER, $
TYPE=TABHEADING, LINE=1, ITEM=1, OBJECT=TEXT, SIZE=14, STYLE=BOLD+ITALIC, $
ENDSTYLE
END
  1. Open a domain or folder in your WebFOCUS Repository. In the Create New pane, click More, and then click Text Editor.

    Copy and paste the syntax example above into the text editor and save the file.

  2. Right-click the report procedure (FEX), point to Schedule, and then click Repository to open the Scheduling tool. When you save this schedule, a report will be distributed back to your folder.
  3. On the ribbon, in the Options group, click the Parameters tab to display the Task Parameters dialog box.
  4. Select the Sale_Date parameter. In the Parameter Properties section, type &YYMD in the Value field.
  5. Select the The value contains a system variable check box.
  6. Select the Company parameter. In the Parameter Properties section, type Widgets&More in the Value field. Make sure the The value contains a system variable check box is cleared for this parameter.
  7. Click OK to close the Task Parameters dialog box.
  8. On the Ribbon, in the Actions group, click Save and Close to save this schedule to your Repository folder.
  9. Navigate to the folder in which your schedule is saved to see your distributed report. Optionally, right-click the schedule and click Run to distribute additional reports.
  10. Double-click your distributed report to open it.

As shown in the following image, the Widgets&More company report distributed on March 27th, 2018 shows the number of items sold on March 27th, 2018, 2017, and 2016.

The Daily Quantity Sold report for the Widgets&More company.

WebFOCUS

Feedback