CX_TRANSACTION::FirstSuccessorByCondition
Description:
This function examines the collection predecessors recursively, when the condition is TRUE and returns the first matching predecessor. If the mode parameter is 1, sub-transactions are also involved in the search process.
If the calling transaction object already meets the condition, it is returned, unless bit 3 of the mode parameter has been set. The Parameter mode controls the - extended - search of the transaction objects of the specialised types CX_COMPOUND_TXN and CX_ALLOCATION_TXN.
Note: To understand which objects are searched and how, the logger cx.model.txn can be switched to TRACE mode. The individual steps are then specified in the log file.
Code example:
Define(PaymentSuccessor)
-> transaction
transaction Cardinality(successors) ifnot { NULL return }
transaction Get(FirstSuccessorByCondition("type(TopTransaction())=CX_FINANCIAL_BOOKING&TopTransaction().financialBookingEnum=3"))
Dup ifnot { Drop NULL return }
Dup transaction @ if { Drop NULL return }
;
Stack | Position | Object type | Brief description |
---|---|---|---|
Stack(In) | Top | CX_TRANSACTION | A transaction |
Top 1 | INTEGER | Mode (bit pattern) 0 (Integer 1) = for documents of type CX_COMPOUND_TXN, the system also displays searches the documents in the subTransactions collection 1 (integer 2) = for documents of type CX_ALLOCATION_TXN, the TopTransaction() document searched 2 (Integer 4) = search only your own successors collection, not the successors of the following documents (no recursive call!) 3 (Integer 8) = the calling transaction object is ignored, even if it should meet the condition | |
top 2 | STRING | Condition | |
Stack(Out) | Top | CX_TRANSACTION or NULL | Successor |