Access to First, Previous, Next, Last record on summary tab

For accessing the next and previous records from the summary page view i have been applying the following logic on primary key and its giving me the required result of giving the previous and last records correctly.

a!queryEntity(
entity: cons!TT_TimesheetLog_Cons,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 1,
sort: a!sortInfo(
field: "id",
ascending: if(ri!fetchingPrevious, false(), true())
)
),
filter: a!queryFilter(
field: "id",
operator: if(ri!fetchingPrevious, "<", ">"),
value: ri!currentPrimaryKey
)
)
).data.id

now the situation is following:

-like the next and previous buttons, I also want the last and first buttons which should take me to the first and last records in the grid, e.g. if i have 100 records the first button should open the first record summary view tab and the last button should open the 100th record. Currently I am not able to do that.

-also if i am on the last record lets say 100 i want the last button to be disabled in that scenario, similarly if i am on first record i want the first button to be disabled.

How can i achieve these two functionalities?

  Discussion posts and replies are publicly visible

Parents Reply
  • Oh. I missed one thing. Try now. 

    a!queryEntity(
      entity: cons!TT_TimesheetLog_Cons,
      query: a!query(
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: 1,
          sort: a!sortInfo(
            field: "id",
            ascending: if(
              or(ri!fetchingPrevious, ri!position = "LAST"),
              false(),
              true()
            )
          )
        ),
        filter: a!queryFilter(
          field: "id",
          operator: if(ri!fetchingPrevious, "<", ">"),
          value: ri!currentPrimaryKey,
          applyWhen: a!isNullOrEmpty(ri!position)
        )
      )
    ).data.id

Children