Index is getting refreshed after changing the page

Certified Associate Developer

Hello All,

I'm getting issues while selecting the data from grid. The overall scenario is something like I have a grid showing 5 rows at a time. I'm storing selected values on one variable and some other information on another variable. The issue that is happening here is related to the data that is getting selected in other variable. As grid shows 5 records at one page, If i will select rows from that page then it takes all the selected values but if select all the rows on page 1 and some more rows on page 2 then it only selects the values from page 2 and stores null value for the records on page 1. for eg:

suppose the grid is something like

EID     Ename

1         abc

2         pqr

3        def

4        ghi

5        lmn

 

Page 2

EID    Enam

6        jkl

7        rst

 

Now lets assume I selected all the rows on both the pages, Then the variable which is taking values on the basis of "identifier" will store all the 7 rows data

i.e. ri!selectedRows=1,2,3,4,5,6,7

but the other variable where i'm using this logic

a!save(

ri!selectedNames,

a!foreach(

items:ri!selectedRows,

expression:{

'type!selectedRows'(

name:index(ri!Datasubset.data.c2,wherecontains(ri!selectedRows[fv!index],ri!datasubset.data.eid),{})

)

}

)

will only store two values that corresponds to row 6 and row 7. This works fine when all the values selected are from same page. Any suggestion?

  Discussion posts and replies are publicly visible

Parents
  • This is default behavior. Selection will be per grid but the ri!Datasubset is per page. Meaning, when you switch to next/previous page, Appian will query DB with the updated paginginfo (startindex of the next page and the batchsize get updated automatically), so the Datasubset will only have data for that page.

    So this 

    index(ri!Datasubset.data.c2,wherecontains(ri!selectedRows[fv!index],ri!datasubset.data.eid),{})
     will only has data for the current page

     

    I wouldn't recommend but you can solve this by getting data from DB for selected identities instead of the datasubset. Basically you will be querying DB everytime a selection is made and this WILL degrade performance. 

  • 0
    Certified Associate Developer
    in reply to Shyam Bommakanti
    Hello Shyam,

    Thanks for your suggestion. Your suggestion actually worked for me, The datasubset which I was calling from the Parent interface has pagingInfo appended to it and that is why it was refreshing the index everytime(As you mentioned). I just passed the whole datasubset without any pagingInfo and its now working fine
Reply Children
No Data