Menu

#35 Improved multi-level indexByPrimaryKey function

Version 10.3.0
open
nobody
None
5
2005-10-21
2005-10-21
No

Hi,

It would be very useful to extend the indexByPrimaryKey
function to support multiple primary keys at the same
time, e.g.

var index = records.indexByPrimaryKey( "key1",
"key2" );

index[ "key1value" ][ "key2value" ];

suchthat only one record can exist for any combination
of primary key field values. This would help to avoid the
common situation where you know this to be the case but
have to use the group function instead, thus:

var index = records.group( "key1", "key2" );

index[ "key1value" ][ "key2value"][ 1 ];

It's only a subtle change, but it does make the code
neater.

Discussion


Log in to post a comment.