LoadAllRecords & Remaining on the current rec

Hi;

Ran into this problem (seems to me an obvious problem, so maybe the solution is already there)

I made a controller that is generic for record views of several different tables. On this controller there is a button “Group” doing a “currentcontroller.loadAllRecords”. This effectifly regroups the records but I loose my “Currentrec”.

While searching for an answer is saw posts referring to foundset.SelectRecord. However this has a problem for my solution

  1. I retrieve the name for the currentform with currentcontrolller.getName

  2. I do currentcontroller getMaxRecordIndex()

  3. I want to say forms[currentform].foundset.selectRecord(PK). But how do I obtain the PK for any given table. I can do currentcontroller.getTable. I can make it a JsTable and do getColumns but I want to do getPKColumn for a given Table. Since this info is stored in Servoy, it should be easy.

Any insights appreciated

You can get the record NUMBER you’re on by using:

currentcontroller.getSelectedIndex()

Then you can store that in an array or in a global or whatever. Then when you navigate back to that view you can use:

currentcontroller.setSelectedIndex(number)

To “go to” that record.

There is currently no specific function to return the primary key field of a given table (to the best of my knowledge).

Hope this helps.