EssGBeginPivot() begins a pivot.
ESSG_FUNC_M EssGBeginPivot (hGrid, pStartCell, pEndCell, ulOptions);
| ESSG_HGRID_T | hGrid |
| ESSG_PRANGE_T | pStartCell |
| ESSG_PRANGE_T | pEndCell |
| ESSG_ULONG_T | ulOptions |
| hGrid | Handle passed back from EssGNewGrid. |
| pStartCell | Describes the cell where the pivot is to originate. The member in this cell describes the dimension to be pivoted. This parameter cannot be NULL. |
| pEndCell | Describes the cell where the dimension is to be placed. A NULL value for this parameter indicates a pivot from Row to Column, or Column to Row for the dimension members. |
| ulOptions | Reserved for future use. Should be set to zero. |
If successful, returns ESSG_STS_NOERR.
None.
ESSG_VOID_T ESSG_BeginPivot (ESSG_HGRID_T hGrid)
{
ESSG_FUNC_M sts = ESS_STS_NOERR;
ESSG_PPDATA_T ppDataIn;
ESSG_PPDATA_T ppDataOut;
ESSG_RANGE_T rDataRangeIn, rDataRangeOut;
ESSG_ULONG_T ulOptions;
ESSG_RANGE_T pStartCell;
ESSG_RANGE_T pEndCell;
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)
{
ppDataIn = BuildTable(&rDataRangeIn);
pStartCell.ulRowStart = 0;
pStartCell.ulColumnStart = 3;
pStartCell.ulNumRows = 1;
pStartCell.ulNumColumns = 1;
pEndCell.ulRowStart = 1;
pEndCell.ulColumnStart = 1;
pEndCell.ulNumRows = 1;
pEndCell.ulNumColumns = 1;
ulOptions = 0;
/* start the pivot operation */
sts = EssGBeginPivot(hGrid,&pStartCell, &pEndCell, ulOptions);
}
if(sts == 0)
{
/* send the entire grid to define the query */
sts = EssGSendRows(hGrid, &rDataRangeIn ppDataIn);
}
if(sts == 0)
{
/* perform the pivot operation */
sts = EssGPerformOperation(hGrid, 0);
/* free the built data */
FreeTwoDim(ppDataIn, rDataRangeIn.ulNumRows);
}
if(sts == 0)
{
/* determine the results of the pivot 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);
}
}