Hi, I believe the next code it should work.
Best regards
var selection = forms[frm].foundset.getSelectedIndexes();
for (var x in selection) {
recSelect = forms[frm].foundset.getRecord(selection[x])
var idRec = recSelect.id; // --- If id is the name of the pk.
}
I think the first option (the one which you do not want to use) is the best, as it gets you the JSRecord objects and on those you can get the PK’s using the function JSREcord.getPKs.
pbakker:
I think the first option (the one which you do not want to use) is the best, as it gets you the JSRecord objects and on those you can get the PK’s using the function JSREcord.getPKs.
Paul
True.
Thanks for the input, for now I will go for a mix
function testbutton()
{
var $arr_pkids = new Array();
var $selectedIndexes = forms[controller.getName()].foundset.getSelectedIndexes();
for (var $i in $selectedIndexes) {
$arr_pkids.push(forms[controller.getName()].foundset.getRecord($selectedIndexes[$i]).getPKs()[0]);
}
application.output("Selected records: " + ($arr_pkids));
}
use what paul told you, thats a way better solution
Now you loop and get the records again from the foundset instead of just doing 1 get.
var $arr_pkids = new Array();
var $records= forms[controller.getName()].foundset.getSelectedRecords();
for (var $record in $records) {
$arr_pkids.push($record.getPKs()[0]);
}