The Sequence class is used for managing database fields of type sequence.
For an overview see page C++ Classes
As explained in page Using Sequences in C++, a C++ Sequence instance is essentially an iterator over the vector of sequence values. When using a Sequence instance it is important to bear in mind that the iterator, once used, in order to be used again needs to be "rewound" by calling method
reset()
to position to the first element in the sequence. This can be an issue when constructing a "pipeline" of operators. For example, in the following code snippet, the Sequencesopen
andclose
are used (iterated) in the expression (which uses the comparison operator ">") to produce the Boolean resultdaysUp
. Then bothopen
andclose
are reset before using them again to produce the Sequenceequal
:
Sequence<float> open = quote.open_project(days); Sequence<float> close = quote.close_project(days); Sequence<mco_seq_bool> daysUp = close > open; open.reset(); close.reset(); Sequence<mco_seq_bool> equal = close == open;As shown above, Sequence objects are typically initialized from the
mcocomp
generatedclassname_fieldname_iterator()
functions for sequence fields. Then the Sequence methods and operators offer a convenient interface for performing operations on the underlying database fields.Please see page Sequence Analytics Methods by Category for detailed explanations and examples.