Get Current Display data

Resolved

Hi there 
 
i want to get the current display data on grid for further process.
 
for example , the user make filter on one column ,and the grid display 5 rows from 10 rows.
 
i want to get this 5 rows only to further process , how can i do this?
 
thank you 🙂

9 answers

WebDataRocks Team WebDataRocks May 9, 2019

Hi Ali!
Thank you posting your question.

There are two ways to get the data from your current report:

  1. By using the getData() method. This method gets the raw data from the current report. Optionally, you can pass a slice as an argument to get a report with specified rows, columns, and measures. 
  2. By using the getReport() method. This method gets the report that is displayed on the grid (with the data source and all the filters, sorting, formats, and conditions). 

We’ve prepared a demo for you that shows how to use both these methods.
Please refer to the documentation to learn more about the parameters of these methods:

Hope this will be useful for your case.
 
Regards,
WebDataRocks Team
 

ali shreef May 9, 2019

Hi there 
 
thank you for your replay , but this is using javascript , i am using angular 2
actually in html i have template reference #povit1 and i pass this variable in method .
 
when i debug and call

pivot1.webdatarocks.getData({}, function(data) {console.log(data)});
 

but i got undefined output 
 
any other way ?
 
 

WebDataRocks Team WebDataRocks May 10, 2019

Hi Ali!
Thank you kindly for your explanation of the problem. 
 
We recommend checking the code of this Angular project:
https://github.com/WebDataRocks/pivot-highcharts-angular
In particular, the app.component.ts file may provide you with some insights about using getData() in Angular projects. Please follow this link to check the details:
https://github.com/WebDataRocks/pivot-highcharts-angular/blob/master/src/app/app.component.ts
 
Hope this is helpful for your case.
 
Best regards,
 
WebDataRocks Team

ali shreef May 12, 2019

Hi there 
 
sorry for too much question , but i have 2 more issues .
1- when i use the geData method with empty option in first parameter like this [

this.child.webDataRocks.getData({}, function(data) {console.log(data)})

] , i got these error message :
ERROR TypeError: Cannot read property ‘members’ of undefined.
 
2- second when i supply the slice object in getData method , i got data but i wearied manner .
instead of getting the objects with row i get the aggregated data. 
the slice option :

‘slice’: {
rows: [
{
uniqueName:”accountNumber”

},
{
uniqueName:”accountDescriptionArabic”
},
{
uniqueName:”transactionDate”
},
{
uniqueName:”journalEntryID”
},
{
uniqueName:”journalDescriptionArabic”
},
{
uniqueName:”currencyId”
},
{
uniqueName:”distributionRefrence”
},
{
uniqueName:”debitAmount”
},
{
uniqueName:”creadiAmount”
},
{
uniqueName:”isPosted”
}
],
measures: [
{
uniqueName:”debitAmount”,
aggregation:”sum”,
format:”debitAmount”
},
{
uniqueName:”creadiAmount”,
aggregation:”sum”,
format:”creadiAmount”
}
],
expands: {
“expandAll”:true
}
}

 
if you cloud tell me by example how to fix the first point OR how can i get rows without aggregation ? 
note :
when  i remove aggregation from the slice option , i get empty result .
 
thank you again 
 

WebDataRocks Team WebDataRocks May 15, 2019

Hi Ali!

Thanks for a quick reply. 

getData method can return already aggregated data only. So the best option for your case is to get currently displayed fields using getReport.
Hope it helps.
 
Regards,
WebDataRocks Team

Julian May 16, 2019

Why it is not posible to return the filtered data?

WebDataRocks Team WebDataRocks May 17, 2019

Hi Julian!
Thank you for writing to us.

Please refer to the first answer in this thread to find more information about getData() and getReport() methods as well as the difference between them. Also, in the above-mentioned demo, you can make sure that these methods return the data with all filters applied. 

Hope this is helpful for you.

Best regards,
WebDataRocks Team
 

ali shreef May 17, 2019

Hi WebDataRocks 
getReport will return all data without filter , and getData will return display data but as tree view in view option. 
is there any way to get rows as display in if i use flat option?
 
thank you for kindly response 🙂

WebDataRocks Team WebDataRocks May 22, 2019

Hello, ali shreef,
Currently, there is no option for getting rows as they are displayed in the flat table.
Please let us know in case of any other question.
Regards,
WebDataRocks Team