TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
Any way to implement a custom button to move to next record in view directly from preview mode?
Hi there!

I was wondering if anyone has been able to create a custom button to move through records displayed in a view directly from the preview mode? For example, lets say that you have a view with some criteria just to show orders that are open. As delivered, if you want to move through the records when you are in preview mode, you have to go back to the view (click the back button) and then manually select the next record that you want to preview. My question is if there's any way to move to the next (or previous) record directly from the preview mode?

Sorry if I posted in the wrong category or if the question has been already answered.

Geronimo Torres
Date Created
11/3/2021 3:09:27 PM
Date Updated
11/25/2021 4:25:11 AM
basenine 11/3/2021 4:07:57 PM
You’d need to:
Create a column which stores the record id.
Create a multi relationship between the table and itself.
Match ID on relationship [record id] <> [record id]
Summary of [record id] using index by date created
Construct URL…something like
URLRoot()&'/preview.aspx?t=XXXXXX&id='&URLEncode([LeadRecord Id])
Create custom button
New Navigate action…custom URL…use the url you constructed earlier

The only bit I’m not certain of is the summary of the record id by date created index
It’ll take some checking to make sure it is the next record
Philipp Matuschka (MMB) 11/4/2021 6:29:19 AM
There's been a request for sometime in the Ideas section asking for this functionality to be implemented as standard. Perhaps you could go there and add your vote. I think you have to search for keyword Next or Previous to find the ticket.
Luison Lassala 11/19/2021 2:12:11 PM
@basenine - Brett, have you tried this out? I'm very keen to get such buttons working on a client's db.

I had a go at it but keep getting errors. I'm a bit puzzled about a couple of things in your instructions:

> I created a new Formula-Text field [browse id] = RecordId() - I presume that's what you meant
> created a Many-to-Many relationship for the same table with itself
> shouldn't the relationship between tables not be [browse id] = [browse id]? (you're using the condition "<>")
> I 'constructed' the URL using a Formula-URL column: [Browse_URL] = URLRoot()&'/preview.aspx?t=XXXXXX&id='&[Browse_Index]
and I get this value for Record_Id=48: "" which works as a URL (it takes me to record '48' but it denies Access to the form's fields even when using Full Access role)
> but in the New Navigate setup form it is asking for a URL rather than for a formula, so I typed in <%[Browse_URL]%>

This is the URL displayed when I click the button -

It gives the error: "The page cannot be found" - where do all those % characters come from???

Luison Lassala 11/19/2021 2:37:12 PM
Actually, correction: I do get full access to the record (I had a typo on the t=XXXXXX value).
And I got the Navigation URL to pick up the value of [Browse_URL] properly so it gets me to the 'correct' record - except the 'correct' record is not the next record, it is the same record!
So there must be a problem with the Index column. This is what I set for it ([Browse_Index]):

"Aggregate: Browse_ID from the record #1 when sorted on Date Created Ascending"
Function: Index
Sort by: Date Created Ascending
Index: By number 1
Value Column: [IBrowse_ID]

Is that correct?
HOw does the Navigate action know when to go to the NEXT record? Should there be a "+1" in the URL column?
Geronimo Torres 11/19/2021 2:57:29 PM
Thanks Basenine! Sorry for the late reply. I have been occupied with some family health issues. Anyways, I think that will work for what I need since I'm just trying to get the functionality for a specific view. So just need to link back to the record using the same criteria as the view. I'll give it a try this weekend.

Geronimo Torres 11/20/2021 7:20:55 PM
Hi @Luison Lassala,

Since I got a bit confused with the use of index and can't think right now I went with a slightly different approach (but same idea, thanks @baseline). I ended up creating the following:
1) New formula with value = RecordId(). Let's call it InternalRecID
----For Next---
2) New multi relationship between the table and itself.
3) Match Condition InternalRecID > InternalRecID
4) New Summary column: Function -> Minimum; Value Column -> InternalRecID
5) New URL formula or button like: URLRoot()&"/preview.aspx?t="&TableId()&"&id="&URLEncode([InternalRecID])&"&back="&BackURL()
----For Previous---
2) New multi relationship between the table and itself.
3) Match Condition InternalRecID < InternalRecID
4) New Summary column: Function -> Maximum; Value Column -> InternalRecID
5) New URL formula or button like: URLRoot()&"/preview.aspx?t="&TableId()&"&id="&URLEncode([InternalRecID])&"&back="&BackURL()

I'll try later using index.

Geronimo Torres 11/20/2021 11:41:25 PM
Oh, sorry! In the formula (step 5) instead of using InternalRecID use the summary column created in step 4.

Also you could create a navigation to last record by getting the last RecordID by adding another summary column in the "Next" relationship as Function = Maximum; Value Column = InternalRecID. For a navigation to first record, do a new summary column in the "Previous" relationship as Function = Minimum; Value Column = InternalRecID. You can then use this values in your formula or button/action.

Hope this helps.
Luison Lassala 11/21/2021 3:56:57 PM
MuchasgGracias @Geronimo for your detailed instructions. It's working!!!!
Luison Lassala 11/21/2021 4:17:24 PM
The only problem is with the URLRoot()&".... formula which keeps giving me errors. So I decided to place the proper URL with the correct Table_ID on the Navigate Action URL instead of a reference formula - that works!
It would be handy to have the URL formula working instead, so I could use it in other tables - but it's not a big deal having a different Navigation URL for the NEXT/PREVIOUS buttons in each Table.
Thanks to both Brett and Geronimo for cracking this one: a very welcome feature for my clients' TeamDesk databases!
basenine 11/21/2021 4:19:23 PM
Can you post the original formula you pasted in....perhaps there's a small syntax error.
Luison Lassala 11/21/2021 4:24:42 PM
This is what I pasted in, a straight copy from what Geronimo had shown:

This is the URL that results from that formula:
basenine 11/21/2021 4:58:54 PM
Interesting. I can't replicate that output when I use Geronimo's formula.
Feel free to DM me via the experts page and send me an invite to the application.

I'm sure it'll be something simple....

Which, in even saying that, has now put the kiss of death on it! lol

basenine 11/22/2021 4:17:04 PM
I got it to work 🙂
I dropped the URLRoot() from the Custom URL property in New Navigate as the New Navigate function appends the URLRoot() to it anyway…who knows why?

I then needed to drop the quote marks and simply put the code brackets in:

Luison Lassala 11/22/2021 4:38:05 PM
Excellent!! Thank you so much Brett - hopefully we all learn something from this exercise.
I tried it and was delighted to see that the BACK button takes you to the previous record view and also back to the View that originated the sequence of NEXT records.
Several of my clients (especially those who migrated from MS-Access or other LAN-based database platforms) have been missing this functionality.
Geronimo Torres 11/22/2021 4:54:38 PM
De nada Luison! I'm glad you got it to work.

I did mine as a Formula URL since I wasn't sure if a workflow action triggered by custom buttons would have counted towards the limit quota... (I really need to find more time to play around TD).

Just another idea... I added a quick summary to show which record of how many the person is looking at. For ex. "Record <##> of <total>". This is basically a formula like: "Record "&Format([Total Files Left Side] + 1,"#,0") &" of "& Format([Total Files Left Side]+[Total Files Right Side]+1,"#,0")

Total Files Left Side => Summary column in relation that has the ">" criteria. Function => # of records in
Total Files Right Side => Summary column in relation that has the "<" criteria. Function => # of records in

So far my client (wife LOL!) found the summary really helpful since she was able to have an idea where she was in the navigation.

Another thing she asked me was to make the deliver Back button to navigate to the previous page that was accessed instead of the previous record. In other words for example, if you navigate to View/Table -> Record Preview -> (Using custom buttons) Next Record and then click the delivered Back, the system will get you back to View/Table instead of the previous record. Not sure if that makes sense lol! Anyways, if you want to keep the back reference from that first Record Preview you can replace the BackURL() with URLEncode(URLParam(URL(),"back")).

For this last one, not sure what difference makes to her since I'm not the one using the system but sharing the idea here just in case is something your clients can benefit from.
Luison Lassala 11/24/2021 3:39:03 AM
@Geronimo - those two suggestions are really useful!!! (congratulate your 'client' about them!), especially the new BACK button which brings the user straight back to the View rather than the Previous record: that is exactly what I wanted!!!

Thank you again for sharing those two drops of wisdom from your wife!
Luison Lassala 11/24/2021 6:43:41 AM
One more adjustment needed for these buttons to work - as RecordId() is TEXT, if there are more than 100 records in the VIEW, the proper sorting is messed up (1, 10, 100, instead of 1,2,3, etc). So I've had to replace the SUMMARY columns (Min or Max) from the Navigation URL with a Format formula to convert the RecordId90 to simple text without decimals (Format([Minimum Id], "0"].
This seems to fix that little quirk.
Luison Lassala 11/25/2021 4:25:11 AM
Sorry folks, I'm afraid these buttons aren't working as expected. I've tested it in several tables for different Clients, and I am always getting 'random' results. Here's what happens:
- search for a set of records using filters and display them on a Table View
- click on VIEW on any of the listed records to display the record's Form
- click on NEXT to display the Form of the following record on the VIEW: sometimes the correct record is displayed, more often it isn't: the record displayed could be lower or even higher in the list

I think what's happening is that the URL is picking up the actual RecordID of the next or previous record, which is fixed and not related to the order in which they are sorted on the Table View.

So this method of using RecordID() would only work when a Table View displays records in sequential order sorted by RecordID.
I guess what we need is a way to generate an Index for the records listed on a View, which gets recalculated when the list is sorted differently from the default sort.

Any ideas if that could be achieved?
Back to Search Results