Get Free Trial

How to get list of filters and data content?

Moshe Malin asked on December 6, 2020

I need to pass the filters that are applied on the table, and the data in table, to an external action.
How can it be done with FM?
(I looked for it, but couldn’t find)

3 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster December 7, 2020

Hello, Moshe,
Thank you for reaching out to us.
Filters applied to the specific field can be retrieved using the getFilter API call. It returns the Filter Object for the specified hierarchy. Use the getReportFilters method without parameters to get all report filters.
If you need to retrieve all filters at once, use the getReport method. It will return the complete configuration of the component, including all applied filters.
Concerning retrieving the data, we want to ask about the final result you want to achieve in your case. It would help us to find the most suitable solution for you.
Currently, we recommend using the export to get the data from Flexmonster. Please see the following documentation to learn more about export in Flexmonster:
Please let us know if it works for your case.
We are looking forward to hearing from you.

Moshe Malin December 7, 2020

Hi, thank you.

But it did not work for me.
I used the following in a simple html:
function setFilters() {
“exclude”: [

function clearFilters() {
function getInfo(){
console.log (‘flexmonster.getReportFilters:’ + flexmonster.getReportFilters().toString());
console.log (‘pivot.getReportFilters:’ + pivot.getReportFilters().toString());
console.log (‘flexmonster.getReport:’ + flexmonster.getReport().toString());
I see that the filter works.
But when trying to retrieve it using getReportsFilter or getReport – I don’t see any reports; nor in debugger.
What am I doing wrong?

Illia Yatsyshyn Illia Yatsyshyn Flexmonster December 9, 2020

Thank you for your feedback.
We have prepared the JSFiddle that demonstrates retrieving both the complete report and a separate filter object.
By default, it has the following slice object with filtering configured:

"slice": {
  "rows": [{
    "uniqueName": "Category",
    "filter": {
      "exclude": [
  "columns": [{
    "uniqueName": "[Measures]"
  "measures": [{
    "uniqueName": "Price",
    "aggregation": "sum"

Click the “Get Info” button to print the report and the filter object to the console of your browser:

function getInfo() {
  let report = JSON.stringify(flexmonster.getReport(), null, 4);
  console.log("REPORT:\n" + report);
  let filterObject = JSON.stringify(flexmonster.getFilter("Category"), null, 4);
  console.log("FILTER OBJECT:\n" + filterObject);

If it does not help, please prepare a sample where the issue would be reproducible. For example, you can use the provided JSFiddle as a template.
Please let us know if it works for you.

Please login or Register to Submit Answer