public method IO2GOrdersTable.getNextRowByMultiColumnValues

Brief

Gets the next row from IO2GOrdersTable based on the multiple columns values.

Declaration
C++
virtual bool  getNextRowByMultiColumnValues (const int columnCount, const char *columnNames[], const void *columnValues[], IO2GTableIterator &iterator, IO2GOrderTableRow *&row) = 0

Parameters
columnCount

Number of columns in which the search is to be performed.

columnNames

The array of column names in the Orders table.

columnValues

The array of values of the columns specified by the columnNames parameter. For example, if you create an entry order with attached stop/limit orders, all orders must have the same RequestID. If you want to search the Orders table for created limit order only, the columnNames parameter value is an array of RequestID and Type, the columnValues parameter is an array containing the value obtained by calling the O2GRequest.RequestID method and the limit order type value, the columnCount parameter value is 2.

iterator

The table iterator.

row

[out] The row fetched.

Details

If the row is not found, the method returns false.

Example

Get orders with the same RequestID and Type from the Orders table [hide]

    O2G2Ptr<IO2GOrdersTable> ordersTable = (IO2GOrdersTable *)tableManager->getTable(Orders);
    bool found = false;
    IO2GTableIterator iterator;
    IO2GOrderTableRow *order = NULL;
    const char *columnNames[] = {"RequestID", "Type"};
    const void *columnValues[] = {(void *)mRequestID, (void *)"L"};
    while (ordersTable->getNextRowByMultiColumnValues(2, columnNames, columnValues, iterator, order))
    {
        found = true;
        std::cout << "OrderID: " << order->getOrderID() <<
                     " Amount = " << order->getAmount() <<
                     " BuySell = " << order->getBuySell() <<
                     " Type = " << order->getType() << std::endl;
        order->release();
    }
    if (!found)
        std::cout << "No orders match specified RequestID and Type." << std::endl;

Note: The returned row contains the current columns values. The values are not automatically updated. To monitor changes, use IO2GTableListener.onChanged. The row interface is thread-safe. The returned row can be used in different threads without synchronization.

Declared in IO2GOrdersTable

back