Yuri wrote at 2007-2-8 15:09 +0100:
I need a field in zope object which act as a sequence. I mean every time I create an object, the value is the previous sequence value of the last object created + 1.
also I need to browse the objects by sequence (from the object 1 to the last, by the sequence number)
I think I need a catalog FieldIndex to store the sequence for searches, a property in the object.
Can I use the catalog to retrieve the max value of the index, so when I create the object, I just add 1 and store it in the property?
You can -- but it is unsafe (concurrent transaction can see the same value and you may use the same id for different objects). A better alternative is to implement the sequence object directly -- as a persistent object with an integer attribute (and a method to fetch the next value). -- Dieter