Wednesday, March 17, 2010

Using a Sequence

Sequences have a lot of use in added logical order to a complex structure. Typically you have a master/parent record at the top of a view, and you need to have numbered child records. Each parent record would have a unique set of numbered children. Sequences can also be used for version control. Here are the steps to making a sequence BC:

Create a BC of class CSSSequence whose name is a concatenation of the source BC name plus '.Version (Sequence)' where Version is the name of the source BC field holding the sequence value. So for example, 'Quote.Version (Sequence)' would be a BC name. In addition set the Sort Spec to Sequence (DESCENDING) and the Table to the same table as the source BC. Create he following fields in the new sequence BC:

Name = Sequence
Column =
Type = DTYPE_INTEGER

Also create fields for the logical key field making the sequence unique. Usually Name or Id or some unique Number. This is how the system finds the next sequence: looks at the source BC with this field value, finds the maximum sequence value and adds one.

Create a link between the Base BC and the Sequence BC, with the Source Field and Destination fields holding the same value. Again this is the logical key indicating when the sequence should reset. Typically Name or Id or a unique Number.

Add the new sequence BC to the Business Object where the sequence will be used linked by the newly created link.

No comments:

Post a Comment