'PivotFilter doesn't work Google App Script
I've some tabular datas in a google sheet submitted via Gform with approximatively this schema:
chronological info, email,item,quantity, label,other fields, date,other fields,total order
Programmaticaly I create some report with pivoTable (in other reports I've only filterd for today date) Now My desire was have a report of all -email (row) -summarizing the value of total order -filter for date==TODAY (filter) -filter for a particular label (second filter)
Problem: I obtain an empty report. This happen only adding the second filter (this result is wrong with my data). I've tested and second filter programmaticaly and doesn't work: the filter appears correct but the pivot table has not results, despite doing it totally manually works. definitively I don't know how use setVisibleValue Filter with PivotTable
code si approximately like this:
let sourceData = SpreadsheetApp.getActive().getRange('\'Risposte del modulo 1\'!A:I')
let label='a label'
let critbuilder= SpreadsheetApp.newFilterCriteria();
let filtertoday=critbuilder.whenDateEqualTo(SpreadsheetApp.RelativeDate.TODAY).build()
let filterclasse=critbuilder.setVisibleValues([label]).build();
let pivotTablePerClassi=SpreadsheetApp.getActive().getRange('\'Report\'!A1').createPivotTable(sourceData);
let pv = pivotTablePerClassi.addPivotValue(9, SpreadsheetApp.PivotTableSummarizeFunction.SUM); //9 total order
let pivotGrouppa = pivotTablePerClassi.addRowGroup(2); //email second column
pivotTablePerClassi.addFilter(7,filtertoday); //today filter
pivotTablePerClassi.addFilter(6,filterclasse);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
