Skip to main content
samadritam1018
Participating Frequently
Jul 3, 2023 10:31 AM UTC
Question

Pagination Error in Read Only Grid

Hi ! I am facing a pagination issue with Grid Field. 
I need to fetch data from a csv using previewcsvimport  and display it in a grid, batch size 10, but an error pops up when I try to move directly to the last page , only for the files which have (10n +1) number of rows.

3 replies

stefanhelzle0001
Brainy
Jul 3, 2023 10:50 AM UTC

Can you share the relevant code snippets and the concrete error message?

samadritam1018
Participating Frequently
Jul 3, 2023 11:00 AM UTC

The error displayed is " Error in a!forEach() expression during iteration 1 :Expression evaluation error at function a!gridColumn" 



local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 10),
local!extractcsvData: previewcsvforimport(
document: todocument(ri!documentId),
delimiter: ",",
charset: "UTF-8",
numberOfRows: 1000
),
local!rowdata: remove(local!extractcsvData.data, 1),
local!data: todatasubset(
arrayToPage: local!rowdata,
pagingConfiguration: local!pagingInfo
),
local!header: todatasubset(
arrayToPage: local!extractcsvData.data,
pagingConfiguration: a!pagingInfo(startIndex: 1, batchSize: 1)
),
local!columns: index(local!header, "data", 1, null),
{
a!cardLayout(
contents: {
a!gridField(
labelPosition: "ABOVE",
data: local!data,
columns: a!forEach(
local!columns,
a!gridColumn(
label: fv!item,
value: a!tagField(
label: fv!row[fv!index],
tags: a!tagItem(
text: fv!row[fv!index],
backgroundColor: "#FFFFFF"
)
)
)
),
pagingSaveInto: local!pagingInfo,
rowHeader: 1
)
}
)
}
)


stefanhelzle0001
Brainy
Jul 3, 2023 11:34 AM UTC

Could it be that not all rows have the same number of fields and the your square brackets indexing fails? Try to use the index() function instead.