Record Navigation

Hi there, I’m new to Servoy and am currently checking it out. I have stumbled at my first hurdle. I am trying to create a button on a form to move to the next or previous record and can’t fid how to do this. Can anyone help with this simple problem?

Ewanm

Hi Ewanm,

Welcome to the forum.

You can navigate through the records using the controller object like so:

var nCurrIndex = forms.yourformname.controller.getSelectedIndex();
forms.yourformname.controller.setSelectedIndex(nCurrIndex + 1);

This will get you to the next record.
When you use a method on the forum itself you don’t have to tell it what form it has to use like so:

var nCurrIndex = controller.getSelectedIndex();
controller.setSelectedIndex(nCurrIndex + 1);

Hope this helps you further.

Robert,

Thanks for the reply, works great. As I said, I’m new to Servoy so I guess I will use the forum a lot to start off with.

Ewanm