Output Statement

Typically, a Flex operator method creates one or more events in response to an event. In order to use these events to affect the store of records, and to send downstream to other streams, use the output statement.

Here's code that breaks up an order into ten new orders for sending downstream:
integer i:= 0;
while (i < 10) {
  output setOpcode([Id = i; | 
                    Shares = InStream.Shares/10; 
                    Price = InStream.Price; ], upsert);
}
Each of these is an upsert, which is a particularly safe operation; it gets turned into an insert if no record with the key exists, and an update otherwise.