# EssGBeginReportFile

Description

EssGBeginReportFile() runs a report file at the server.

Syntax

    ESSG_FUNC_M EssGBeginReportFile (hGrid, pszReportName, bLocal, ulOptions);

ESSG_HGRID_T | hGrid
ESSG_STR_T | pszReportName
ESSG_BOOL_T | bLocal
ESSG_ULONG_T | ulOptions

Parameters

hGrid | Handle passed back from EssGNewGrid.
pszReportName | Name of report to run. If this report resides on the server, then it should exist in the APPLICATION\DATABASE directory. If this report resides locally, then this string contains the absolute path name of the report.
bLocal | Boolean indicating whether the report exists locally or not. A TRUE value indicates the report exists locally while a FALSE value indicates the report exists on the server.
ulOptions | A bitmask which describes returned grid options. Valid values are: ESSG_NOATTRIBUTES returns grid without pAttributes values

Return Value

If successful, returns ESSG_STS_NOERR.

Notes

- Runs a report file at the server.
- Returns the results as a two-dimensional array of cells.
- You do not need to send any rows for this operation. It is sufficient to call EssGPerformOperation, EssGGetResults, and EssGGetRows.
- Attributes for returned cell values are obtained using a second server request. Passing ESSG_NOATTRIBUTES for the ulOptions parameter will issue one less request of the server, and could, in large resulting grids, be faster.
- Reports passed to the server via the Grid API should be sure to request a tab delimited report format be returned {TABDELIM}. If a non-tab delimited report is returned, the Grid API may be unable to convert the resulting report into a grid.
- If the report spec modifies the string used for #Missing aliases, then Missing cells will be returned as string types (ESSG_DT_STRING) with the new #Missing alias as the text and not as ESSG_DT_MISSING cells.
- For non-local (Server-based) report file objects, no file extension should be used in the pszReportName parameter.

Access

None.

Example

    ESSG_VOID_T ESSG_BeginReportFile (ESSG_HGRID_T hGrid)

    {
      ESSG_FUNC_M     sts = ESS_STS_NOERR;
      ESSG_PPDATA_T         ppDataOut;
      ESSG_RANGE_T          rDataRangeOut;
      ESSG_ULONG_T          ulOptions;
      ESSG_STR_T            pszReportName;
      ESSG_BOOL_T           bLocal;
      ESSG_USHORT_T         usState;

      /* connect the grid to a database on the server */
      sts = EssGConnect(hGrid, "Rainbow", "Admin",
            "Password", "Demo", "Basic",
            ESSG_CONNECT_DEFAULT);

      if(sts == 0)
      {
         pszReportName = "DescYear";
         bLocal = ESSG_FALSE;
         ulOptions = ESSG_NOATTRIBUTES;

         /*start the report file operation */
         sts = EssGBeginReportFile(hGrid,
               pszReportName,bLocal, ulOptions);
      }

      if(sts == 0)
      {
         /* perform the report operation */
         sts = EssGPerformOperation(hGrid, 0);
      }

      if (sts == 0)
      {
         /* determine the results of the report operation */
         sts = EssGGetResults(hGrid, 0, &rDataRangeOut, &usState);
      }

      if(sts ==0)
      {
         /* get all the data */
         sts = EssGGetRows(hGrid, 0, &rDataRangeOut,
               &rDataRangeOut, &ppDataOut);
      }

      if(sts == 0)
      {
         DisplayOutput(ppDataOut, rDataRangeOut);
         /* Free the returned data */
         EssGFreeRows(hGrid, &rDataRangeOut, ppDataOut);
      }

      if(!sts)
      {
         EssGEndOperation(hGrid, 0);
         EssGDisconnect(hGrid, 0);
      }
    }

See Also

Using the Grid API Functions
Grid API Structures