Page 1 of 1

How can I address a certain table for looping its rows?

PostPosted: Wed Aug 04, 2021 5:29 am
by loseend
Hi there,

actually it's a question to Apprentice.

In order to checking pending trades you loop the table "trades":
enum = core.host:findTable("trades"):enumerator()

In the debugger this table is named "Trades" - not "trades".

Now, I would like to check the table "ClosedTrades".
But ' enum = core.host:findTable("ClosedTrades"):enumerator()' won't find the table. Can you tell me under which name this table is assigned?

Thank you very much.

Re: How can I address a certain table for looping its rows?

PostPosted: Thu Aug 05, 2021 5:56 am
by Apprentice
It is "Closed Trades"

Code: Select all
    local enum, row;
    local count = 0;
    enum = core.host:findTable("Closed Trades"):enumerator();
    row = enum:next();
    while row ~= nil do
         Text= Text.. tostring(row.AccountID)

        row = enum:next();
    end


This is another implementation you can use.
Make sure you close some trades.

Re: How can I address a certain table for looping its rows?

PostPosted: Thu Aug 05, 2021 9:22 am
by loseend
Great! You helped me out, Apprentice.
Thank you very much!!