Question on how to persist paging info

Persist Paging Info:

Hi All,

I am trying to persist paging Info so that when User comes back to that page, we can get on the same page of the grid. But it is always showing the default values of first page. Can you please guide how can I fix it?

Thanks

OriginalPostID-201229

OriginalPostID-201229

  Discussion posts and replies are publicly visible

  • Just add an ri! of type pagingInfo which is mapped to a pv! and then pass that pv! back into the form when you return to it.
  • @rishub Afaik, it could be done in two ways:

    1. If you are moving out of the user input task and navigating back to the same(after performing user input task or system activities) after a while, you can create a PV of type 'PagingInfo'. Create an ACP of type 'PagingInfo' in the User Input Task which you want the PagingInfo to be persisted. Pass the PV to the ACP. Also make sure that the interface rule has an input to accept this pagingInfo value (via a rule input) and pass the value of ACP to it. Additionally make sure that the PV holds a default value(or you can even control the same on the interface by providing a default value if the value of the input is null) for the first time when the task is hit, and later on you can persist the changes made to it by capturing the value of ACP into PV. Later you may reset the value of the PV in the process on need basis.

    2. If there isn't a possibility to come back to the current User Input Task, then you don't need to create a PV for this purpose. Just create a ACP of type 'PagingInfo' and populate it with a default value (or you can even control the same on the interface by providing a default value if the value of the input is null) and pass the ACP to the rule input. Also make sure that the interface rule has a input to accept this pagingInfo value (via a rule input) and pass the value of ACP to it. Prefer this way, if the 'PagingInfo' scope ends after submitting the current User Input Task and this helps you refraining from creating an additional PV.
  • Hey Philb/ Sikhivahans,

    I am trying for approach 1 only but it is not working for me. Below is the sample code I am trying:

    =load(
    local!documentAssetId:ri!documentAssetID,
    local!documentGridPagingInfo: if(rule!APN_isEmpty(ri!pagingInfo),a!pagingInfo(
    startIndex:1,
    batchSize:5,
    sort:{a!sortInfo(
    field:"docID",
    ascending:true
    ),
    a!sortInfo(
    field:"ID",
    ascending:true
    )
    }
    ),ri!pagingInfo) ,
    local!tempSel,
    local!GridSelectionInfo: a!gridSelection(
    pagingInfo:local!documentGridPagingInfo,
    selected:if(isnull(local!Id),local!tl,local!Id)

    ),
    local!allRecord:rule!rule1,
    local!allDatasubset:todatasubset(local!allRecord,topaginginfo(1,-1)),
    local!selectedDocumentIndex:if(not(fn!isnull(local!Id)),lookup(index(local!allRecord,"ID",{}),local!Id) ,null),
    with(
    local!AllInfo:todatasubset(local!allRecord,local!GridSelectionInfo.pagingInfo),
    local!PAsMissingAttrAssetIds:rule!rule2(index(local!AllInfo.data,"assetID",{0})),
    {

    a!sectionLayout(
    label:"Business Identifier Information",
    firstColumnContents:{ rule!PDIM_SAIL_ShowIdentifiersGrid(ri!identifierDetails)}),

    a!sectionLayout(
    label:"Documents",
    firstColumnContents:{



    a!gridField(

    label:"",
    totalCount:local!AllInfo.totalCount,
    columns:{
    a!gridTextColumn(
    label:"A ID",
    field:"ID",
    data:index(local!AllInfo.data,"ID",{})
    ),

    a!gridTextColumn(
    label:"TID",
    field:"dTID",
    data:index(local!AllInfo.data,"dTID",{})
    ),

    a!gridTextColumn(
    label:"Desc",
    field:"dDesc",
    data:index(local!AllInfo.data,"dDesc",{})
    ),

    a!gridImageColumn(
    label: "Attributes",
    field:"ID",
    data:fn!apply(rule!rule3,index(local!AllInfo.data,"ID",{}), index(local!MissingIds,"ID",{0})),
    size: "ICON"
    )
    },
    identifiers:index(local!AllInfo.data,"ID",{}),
    value:local!GridSelectionInfo,
    saveInto:{
    local!GridSelectionInfo,
                                             a!save(ri!pagingInfo, local!GridPagingInfo),
    a!save(local!dId,index(save!value, "selected", null)),
    a!save(local!selectedIndex, lookup(index(local!AllInfo.data,"ID",{}),index(save!value, "selected", null)))
    },
    selection:true,
    disabled:ri!gridDisabled,
    validations: if(ri!missing,"missing","")

    )
    }
    )
    }
    )

    )
  • if you see, I am saving GridpagingInfo into ri!paginginfo but it is always saving default value.
  • @rishub Instead of a!save(ri!pagingInfo, local!GridPagingInfo), it might be worth doing as follows:

    a!save(ri!pagingInfo, index(local!GridSelectionInfo,"pagingInfo",null)),
  • Sikhivahans, It did not work. I tried to do that but it is saving null value now.
  • A few questions here:

    1. Did you pass the ACP to the rule input of interface?
    2. Did you configure the input (of the User Input Task) with value of PV?
    3. Did you save the input (of the User Input Task) into the PV?

    Also would you be able to debug the value of 'ri!pagingInfo' (For instance, make use of a text field to see its value) and see the value hold by it? Perform this step after paginating or sorting through the grid.
  • Hey Sikhivahans,

    I debugged the values & it is always showing as startIndex=1, batchSize=5,