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.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 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
    )
    }
    )
    }
    )


  • 0
    Certified Lead Developer
    in reply to SM

    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.