Enables you to apply a row grouping function on columns in a selection.
Syntax
CHGVAR |
VAR(&CMD) VALUE('XLSUBTOTAL') |
CHGVAR |
VAR(&PARM1)
VALUE(' [;Ref=" Selected
cell reference"] |
CHGVAR |
VAR(&PARM2) VALUE(' ') |
CALL |
PGM(LNCCMD) PARM(&HANDLE &CMD &OPT &PARM1 + &PARM2 &RESULT) |
Parameters
Paramètres |
|
Parm1 |
Ref: The
reference of the area to be treated. If Ref is absent, all cells in the sheet will be processed. Sheet:
Specifies the name of the sheet to be processed. RefTo:
Reference to the cell at the bottom right of the selected area. This
reference is given in the form: GroupBy: This
option specifies the rank of the column to use to group summation. The
columns are numbered from 1 to n. Function:
Designates the function to apply. Replace: False
not to replace the current subtotals. PageBreaks: To add
a page break after each group. SummaryBelowData: Allows
you to choose the position of subtotals. |
Example
In the following example, subtotals are created for column 12, with groupings made based on columns 1 and 6.
All the cells of the "data" sheet are taken into account.
PGM
LNCOPEN
LNCCMD CMD(EXCELOPEN)
LNCCMD CMD(XLOPENFILE) PARM1('C:\A\DataRef.XLSX')
LNCCMD CMD(XLGOTOSH) PARM1('data')
LNCCMD CMD(XLSUBTOTAL) +
PARM1('sheet="data";GroupBy=1;Function=xlSu+
m;TotalList="12"')
LNCCMD CMD(XLSUBTOTAL) +
PARM1('sheet="data";GroupBy=6;Function=xlSu+
m;TotalList="12";REPLACE=FALSE')
LNCCMD CMD(XLSAVEAS) +
PARM1('C:\A\RES.XLSX;replace=true')
LNCCMD CMD(EXCELCLOSE)
LNCCLOSE
ENDPGM
To apply subtotals only on a selection of cells, you can use the following command:
LNCCMD CMD(XLSUBTOTAL) +
PARM1('Ref="A1";RefTo="N14";sheet="data";Gr+
oupBy=1;Function=xlSum;TotalList="12"')