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
Depending on what "next" and "previous" actually means, in terms of sorting your records, you would just need to add the buttons and an a!save() which loads that next/previous record into a local variable. Then your interface will display the just fetched data.
Did you already try something?
I haven't tried anything yet, but I will try that!
So I would add the buttons and put the a!save into where the button's codes are as well? And would the a!localvariable just be wrapped around the a!save/the buttons? It's just hard to visualize that without any examples
Yes. Like here: docs.appian.com/.../recipe-refresh-data-using-a-refresh-button.html
Regarding local variables, I try to use only one global scope of local variables on top of my code. Nesting multiple a!localVariables() can be done but is rarely needed.
I tried creating an entity but it needs a data store which I don't have. This seems pretty complicated, I might just search the discussion board to hopefully find a different way
What do you mean with "creating an entity"? For what purpose? The recipe I shared is just an inspiration which you will need to adapt to your needs.
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
davinar9817 said:I am using a record type but
Then you'd just use queryRecordType instead of QueryEntity. Everything else should work essentially the same.
davinar9817 said: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.
Mike Schmitt said: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
Mike Schmitt said: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.