Hi, is there a way to limit the query to a few rec...
# gooddata-ui
m
Hi, is there a way to limit the query to a few records with useExecutionDataView? The pivot table works perfect, it's has some super advanced features by default, like scroll on load and so on, this is amazing. But if I need to customise the table like color certain data point, I need to query with useExecutionDataView and the dataset is very large, takes 18 seconds. Any workarounds, like pagination for query or limit to first x records?
i
@Michael Serres Hi,
useExecutionDataView
hook you are using consumes this as its param
Copy code
config: IUseExecutionDataViewConfig & UseExecutionDataViewCallbacks
Check the documentation of IUseExecutionDataViewConfig and you will see there is prop called
window
where you can specify offset and size limit for execution result
m
Oh nice, that's the "advanced" part of the docs. Thanks, will give it a try.
const { result, error, status } = useExecutionDataView({ execution: { seriesBy, slicesBy, filters }, window: { offset: [0], size: [500] }, }); Works beautifully. There's for first 500 records. Since offset and size are arrays, anything else I should know @Ivan Nejezchleb?
m
Hello @Michael Serres. Offset/size are arrays because you should specify it per each dimension. Most of the time, you need only 1 or 2 dimensions, and the offset and size will be the same. But in some cases, you may need different offset / limit per dimension - good example is pagination of the pivot table. I’ll make a ticket to describe it in a better way on a
DataViewWindow
interface.
m
Quite powerful, thank you. much appreicated.