Running a Talking Report With a Follow-up Question


You can also set up multiple reports to run off of each other, by asking WebFOCUS follow-up questions for the content of each report. In addition to a TALKTEXT Compute field, we will set a global parameter that will be used in and by both reports.

For this more advanced example, we will create two procedures that work with one another. To create this type of report, you must use the Text Editor that is available from the WebFOCUS Home Page.

From the WebFOCUS Home Page, on the Action bar, click the Other tab, and then click Text Editor.

In the first report, we have values for City Name and Quantity Sold. Let’s set City Name to be a global variable of &&CITY_NAME, by using a SET command, and making it equal to the local variable of &CITY_NAME. This variable will be required for the report to run.

You can copy and paste the following sample code to test this example yourself. You must have access to WebFOCUS Retail Sample data for this example to work on your machine.

-SET &&CITY_NAME = &CITY_NAME;
TABLE FILE retail_samples/wf_retail
SUM
WF_RETAIL.WF_RETAIL_SALES.QUANTITY_SOLD
COMPUTE
TALKTEXT/A200='Total number of units sold for &CITY_NAME is ' | FPRINT
( WF_RETAIL.WF_RETAIL_SALES.QUANTITY_SOLD , 'I8C' , 'A12' ) ;
WHERE WF_RETAIL.WF_RETAIL_GEOGRAPHY_STORE.CITY_NAME EQ &CITY_NAME.(FIND
WF_RETAIL.WF_RETAIL_GEOGRAPHY_STORE.CITY_NAME IN retail_samples/WF_RETAIL |
FORMAT=A50V).City Name:.QUOTEDSTRING;
ON TABLE SET PAGE OFF
ON TABLE PCHOLD FORMAT &WFFMT
END

The highlighted text in the TALKTEXT shows that the local parameter for local variable of City Name will be used by WebFOCUS to respond to your inquiry for the first report, and as context for the second report, as shown in the following image.

TALKTEXT example

Define your intent phrase to be “How many units were sold”, and load your dimensional data in to the search index. This then results in the following verbal interaction between you and WebFOCUS:

User: How many units were sold?
WebFOCUS: Please say a value for city name.
User: Chicago
WebFOCUS:

Chicago total units sold

Now, let’s set up a second report that is called after the first report is run, and uses the same variable that was just spoken to WebFOCUS. Here, we use the SET command again, but in this example the local variable of &CITY_NAME is set to equal the global variable from the first report. The TALKTEXT Compute then uses these variables to run the query.

You can copy and paste this sample code to test this example yourself:

-SET &CITY_NAME = &&CITY_NAME;
TABLE FILE retail_samples/wf_retail
SUM WF_RETAIL.WF_RETAIL_SALES.REVENUE_US NOPRINT
COMPUTE
TALKTEXT/A200='Total revenue for &CITY_NAME is ' | FPRINT
( WF_RETAIL.WF_RETAIL_SALES.REVENUE_US , 'I8CM' , 'A12' );
BY WF_RETAIL.WF_RETAIL_GEOGRAPHY_STORE.CITY_NAME
WHERE WF_RETAIL.WF_RETAIL_GEOGRAPHY_STORE.CITY_NAME EQ '&&CITY_NAME'
ON TABLE PCHOLD FORMAT &WFFMT
END

Fex example

Define your intent phrase for this report to be “What was the revenue”, and load your dimensional data in to the search index. When you speak your query for the first report, and click the microphone again, WebFOCUS remembers the city name that you spoke, and responds to your second query using that information, resulting in the following interaction between you and Mobile Voice.

User: What was the revenue?
WebFOCUS:

Store revenue result

WebFOCUS assumes that this intent phrase is related to the previous city name that was given, in this case, Chicago.

For more information on setting intent phrases, see Defining Intent Phrases.