Next and Back Button for Records in a Read-Only Grid

So I have a read-only grid displayed on a site through an interface. The summary is also displayed through an interface, and the summary of a record is pictured below.

What I want to do is add a button, going to the next or previous record so that the user doesn't have to click the home button in the top-left.

I found this thread but wasn't sure how to apply it to my situation (not completely sure how to apply a!query):

community.appian.com/.../access-to-previous-and-next-records

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Did you read the answers I provided in the therad you linked?  What exactly are you not able to figure out?  FWIW the answers I'd give for this question now are no different from what I answered there, except for adjusting as needed for data sourced via Synced Records instead of Query Entity.

  • Yes I did, I don't understand where to put the a!queryEntity in relation to the button(s), and also how to create a datastore for the entity. I am using a record type but I'm not sure where to get the datastore from

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

  • +1
    Certified Lead Developer
    in reply to davinar9817
    I am using a record type but

    Then you'd just use queryRecordType instead of QueryEntity.  Everything else should work essentially the same.

    I don't understand where to put the a!queryEntity in relation to the button(s)

    As I wrote in the other thread, you will need to use Links for this, as Buttons have no way to do actual Record Link functionality which is what you'll really want to use here.  As for where to query the data: you would query it with the other local variables at the top of the form - basically just to get the identifiers for "next record" and "previous record".  Then you would place your links wherever you want - on the bottom, at the top, in very tiny columns on the sides, etc... that's up to you.

  • Then you'd just use queryRecordType instead of QueryEntity.  Everything else should work essentially the same.

    That makes much more sense, that's a big part of why I was confused

    As I wrote in the other thread,

    Alrighty I will try this now, sometimes being a beginner makes me feel really inept for things that should be simple like this. 

  • +1
    Certified Lead Developer
    in reply to davinar9817

    No worries - I was a beginner long enough ago that sometimes I forget how confusing things could be.  Things are certainly better these days though, lol.

    Anyway in case it helps, here's an equivalent example of the "previous entry identifier" query from the older thread, but converted into a!queryRecordType() style funcitonality.  Note that the changes are mainly to formatting / semantics, while the functionality / idea largely remains the same.

Reply
  • +1
    Certified Lead Developer
    in reply to davinar9817

    No worries - I was a beginner long enough ago that sometimes I forget how confusing things could be.  Things are certainly better these days though, lol.

    Anyway in case it helps, here's an equivalent example of the "previous entry identifier" query from the older thread, but converted into a!queryRecordType() style funcitonality.  Note that the changes are mainly to formatting / semantics, while the functionality / idea largely remains the same.

Children
No Data