Is it possible to delete a value from an Array? If so, how can I do so?
have a look here: java script question on arrays - Classic Servoy - Servoy Community
Thanks Patrick,
Gave that one a better look but when I do the following Servoy tells me splice is not a function
var Groups = security.getGroups();
for ( var i = 0 ; i < Groups.getMaxRowIndex() ; i ++ )
{
if (Groups.getValue(i, 2) == "Administrators")
{
Groups.splice(i, 1);
break;
}
}
application.setValueListItems("usergroups" , Groups.getColumnAsArray(2), Groups.getColumnAsArray(1));
I haven’t tested it, but I think you need to make sure that you really have a Java Script array. To me it looks like security.getGroups() is a Javaarray. I ran across the same problem. See the response from Johan in that discussion and what was my workaround. It should work then…
Yes I have read that. In that case I have to build the array again and That is what I already do. I was just looking for a shortcut…
getGroups is not an array but a dataset.
it contains rows of multiply colums, so yes we could do it in an array but then you have to do things like:
array[row][column] xxx
instead of
ds.getValue(row,column)
the latter is a bit cleaner.
OK, no issue at all. Thanks for your answers…