lastIndex=(Number)lastIndex.valueForKey(indexKey());
lastIndex=(Number)lastObject.valueForKey(indexKey());
    public WOComponent selectAction() {        EOEnterpriseObject _localEoToAddToRelationship = _eoToAddToRelationship != null ?        EOUtilities.localInstanceOfObject(editingContext(),_eoToAddToRelationship) : null;        if (_localEoToAddToRelationship != null) {            // we create a join EO            EOEnterpriseObject joinEO=ERXUtilities.createEO(entity().name(),                                                             editingContext());            NSArray sortedObjects=relationshipDisplayGroup.displayedObjects();            Number lastIndex=ERXConstant.ZeroInteger;            if (sortedObjects!=null && sortedObjects.count()>0) {                EOEnterpriseObject lastObject=(EOEnterpriseObject)relationshipDisplayGroup.displayedObjects().lastObject();                lastIndex=(Number)lastIndex.valueForKey(indexKey());            }            int newIndex=lastIndex!=null ? lastIndex.intValue() : 0;            joinEO.takeValueForKey(ERXConstant.integerForInt(newIndex),indexKey());            joinEO.addObjectToBothSidesOfRelationshipWithKey(_localEoToAddToRelationship,                                                             destinationRelationship().name());            object().addObjectToBothSidesOfRelationshipWithKey(joinEO, _relationshipKey);            dataSource().insertObject(joinEO);            relationshipDisplayGroup.fetch();        } else {            // no object was selected            _state = QUERY;        }        return null;    }