The GRAPH Command

Topics:

GRAPH request syntax is similar to TABLE request syntax. To produce a graph instead of a tabular report, you need only substitute the command GRAPH for TABLE in the request. Thus, you can produce graphs by simply converting TABLE requests to GRAPH requests.

However, not every TABLE facility has a GRAPH counterpart, and there are some practical limitations on the amount of information that you can effectively display in a graph. When a TABLE request is converted in this manner, the various phrases that make up the body of the request take on special meanings that determine the format and layout of the graph. The type of graph produced by a GRAPH request depends on the display command used (SUM or PRINT), and the sort phrase(s) used (ACROSS or BY).

Similarities Between GRAPH and TABLE

The GRAPH request elements generally follow the same rules as their TABLE counterparts:

  • The word FILE and the file name must immediately follow the GRAPH command, unless they were previously specified in a SET command:
    SET FILE=filename

    You can specify any file available to WebFOCUS, including joined or cross-referenced structures.

  • You can concatenate unlike data source files in a GRAPH request with the MORE command. For details, see Universal Concatenation.
  • The order of the phrases in the request does not affect the format of the graph. For example, the selection phrase may follow or precede the display command and sort phrase(s). The order of sort phrases does affect the format of a graph, just as the order of sort phrases in TABLE requests affects the appearance of reports.
  • The word END must be on a line by itself to complete a request.
  • All dates are displayed in MDY format unless they are changed to alphanumeric fields.

Differences Between GRAPH and TABLE

There are a few notable syntactical differences between TABLE and GRAPH. Specifically, the following restrictions apply:

  • A GRAPH request must contain a display command with at least one display field and at least one sort phrase (BY or ACROSS) in order to generate a meaningful graph.
  • In GRAPH requests the object of the display command must always be a numeric field.
  • No more than five display fields are permitted in a GRAPH request. Standard graph formats generally do not permit more variables to be displayed without rendering the graph unreadable.
  • Several BY phrases can be used in a request, in which case multiple graphs are created. A single ACROSS phrase is allowed in a GRAPH request, and requests for certain graph forms can contain both ACROSS and BY phrases.
  • The number of ACROSS values cannot exceed 64.
  • The RUN option is not available as an alternative to END.

Example: Converting a TABLE Request to a GRAPH Request

The following illustrates how a TABLE request can easily be converted into a GRAPH request by changing the TABLE command to a GRAPH command.

TABLE FILE GGORDER
HEADING CENTER
"SAMPLE TABLE"
SUM QUANTITY
BY PRODUCT_DESC AS 'Coffee Types'
WHERE PRODUCT_DESC EQ 'French Roast' OR 'Hazelnut' OR 'Kona'
END

The output is:

        SAMPLE TABLE
Coffee Types      Ordered Units
------------      -------------
French Roast             285689
Hazelnut                 100427
Kona                      61498

The same request with a GRAPH command in place of the TABLE command is:

GRAPH FILE GGORDER
HEADING CENTER
"Sample Graph"
SUM QUANTITY
BY PRODUCT_DESC AS 'Coffee Types'
WHERE PRODUCT_DESC EQ 'French Roast' OR 'Hazelnut' OR 'Kona'
END

The output is:

WebFOCUS

Feedback