public method IO2GTradesTable.getNextRowByMultiColumnValues

Brief

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

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

Parameters
columnCount

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

columnNames

The array of column names in the Trades table.

columnValues

The array of values of the columns specified by the columnNames parameter. For example, if you want to search the Trades table for positions by account 12345 and EUR/USD instrument, the columnNames parameter value is an array of AccountID and OfferID, the columnValues parameter is an array of 12345 and 1, 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 open positions by specified AccountID and OfferID from the Trades table [hide]

    O2G2Ptr<IO2GTradesTable> tradesTable = (IO2GTradesTable *)tableManager->getTable(Trades);
    bool found = false;
    IO2GTableIterator iterator;
    IO2GTradeTableRow *trade = NULL;
    const char *columnNames[] = {"AccountID", "OfferID"};
    const void *columnValues[] = {(void *)"12345", (void *)"1"};
    while (tradesTable->getNextRowByColumnValues(2, columnNames, columnValues, iterator, trade))
    {
        found = true;
        std::cout << "TradeID: " << trade->getTradeID() <<
                     " OfferID = " << trade->getOfferID() <<
                     " Amount = " << trade->getAmount() << std::endl;
        trade->release();
    }
    if (!found)
        std::cout << "You don't have any open positions by specified account and instrument.");

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 IO2GTradesTable

back