Page 1 of 1
Iterate Records
Posted: 02 Jan 2019
by CW
Is it possible to add two buttons at the top of a form to iterate back a record or go to next record? Such as <<Previous Record Next Record>>.
I know there is a framework example for previous, but that's just like the back button on a browser.
TX
CW
Re: Iterate Records
Posted: 04 Jan 2019
by AlexZver
Hi!
We are working on your issue and soon will give you an answer.
Re: Iterate Records
Posted: 04 Jan 2019
by AlexZver
Hi again!
I have some doubt if I understand your task correctly... I thought you try to iterate through the fields of the form but it's actually not your case, isn't it?
Please correct me if I mistaken, do you want to iterate through the items of the list with the help of these buttons? Pushing a previous button opens an Edit form of the previous item of the parent list and pushing a next button - next item? Will the current form be saved after the redirection if any changes applied? Or it's only for Display forms?
Please provide more details to your request to help us suggest a proper solution. The screenshots are very welcome!
Re: Iterate Records
Posted: 04 Jan 2019
by CW
Hi. Yes iterating through records, not fields. Iterate the way you would in list form scrolling down through the list items.
My idea is pretty much the same as the record navigating function of MS Access.
Re: Iterate Records
Posted: 05 Jan 2019
by AlexZver
Hi!
I'm sorry, I still have a slighted vision of your request... More details would be much appreciated. Could you please provide a screenshot of functionality you want to achieve?
Re: Iterate Records
Posted: 05 Jan 2019
by CW
Sure thing. I've included the screen shots.
Song (Chart) list
- ChartList.png (72.13 KiB) Viewed 2347 times
View Form of a Record
- SelectedSong.png (40.75 KiB) Viewed 2347 times
View with Next/Prev Navigation buttons
- PrevNext.png (79.15 KiB) Viewed 2347 times
Re: Iterate Records
Posted: 07 Jan 2019
by Nikita Kurguzov
Dear CW,
Technically it's very easy to redirect user to the next item or previous item in the list, you can simply replace the ID in the URL. For example, this code would open the same form for the item with next ID (e.g. 1
2)
Code: Select all
var id = fd.getUrlParam(window.location.href, 'ID');
var nextID = Number(id) + 1;
var url = window.location.href.replace("ID=" + id, "ID=" + nextID);
window.location.href = url;
But there is a big issue here. It will give an error if the item does not exist. And it could've been simply deleted or never created yet (last item in the list).
Now, working around this is much harder. You'll need to send JS requests to the List, retrieve what items are available in the list, and if there are some, then redirect.
This article should be helpful.
Now, we can most likely help with the process, but we first need to discuss it, so if you are interested, please, write us -
support@spform.com
Re: Iterate Records
Posted: 07 Jan 2019
by CW
Of course, that makes sense. I'm not a coder like you so I thought it may be simpler.
No big deal, thought it was something to try out but not worth spending time on.
Thanks for the suggestion though. Maybe one day, when I'm bored I can try it out.
CW