Go Back   DailyFX Forum > FXCM Products and Services > FXProgrammers > Discussion / Support Forum > Order2Go COM Trading API Support

Reply
 
Thread Tools Rate Thread
  #1 (permalink)  
Old 11-02-2009, 12:03 PM
Member
 
Join Date: Jul 2009
Posts: 41
Kalzenith is an unknown quantity at this point
is there an easy way to find the index of a string?

in C# i was wondering, if i had a table defined like this

FXCore.TableAut Trades = (FXCore.TableAut)tradeDesk1.FindMainTable("trades" );

is there any way i can do somrthing like this?

Trades.IndexOf("String")

what i need, is a way to find the row containing a specific OpenOrderID without passing the whole table to an array or list if at all possible

edit: sorry, i think ive already answered my own question with the FindRow function.. am i right in assuming that is the function i need? and if im right, how do i use the function? i need to find the row of a specific OpenOrderID, it returns an object but i just need the row number as an integer and i keep getting this error

Unable to cast COM object of type 'System.__ComObject' to interface type 'System.IConvertible'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{805E3B62-B5E9-393D-8941-377D8BF4556B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

uint d = Convert.ToUInt32(Trades.FindRow("OpenOrderID", "4975537", 0));

Last edited by Kalzenith; 11-02-2009 at 02:24 PM..
Reply With Quote
  #2 (permalink)  
Old 11-02-2009, 02:24 PM
Member
 
Join Date: Jul 2009
Posts: 41
Kalzenith is an unknown quantity at this point
i also tried this

uint d = (uint)Trades1.FindRow("OpenOrderID", "4975537", 0);

but it told me "Specified cast is not valid."
Reply With Quote
  #3 (permalink)  
Old 11-02-2009, 04:42 PM
Member
 
Join Date: Jul 2009
Posts: 41
Kalzenith is an unknown quantity at this point
ive found another thread pertaining to findrow(), it apparently returns the row, not the index of the row which i believed. so i just wrote a for loop to search the table for the OpenOrderID

for (uint h = 1; h < Trades.RowCount; h++) if ((string)Trades.CellValue(h, "OpenOrderID") == TradeArray[g, 0]) index = h;
Reply With Quote
  #4 (permalink)  
Old 11-03-2009, 10:55 AM
Member
 
Join Date: Apr 2009
Posts: 53
fexxxer is an unknown quantity at this point
If you want to find a specific row, you can do it like this:

Finding a QuoteID for specific instrument:

Code:
string instrument = "EUR/USD";
FXCore.TableAut offers = (FXCore.TableAut)tradeDesk.FindMainTable( "offers" );
FXCore.RowAut row = (FXCore.RowAut)offers.FindRow("Instrument", instrument, 0);
string quoteId = row.CellValue("QuoteID").ToString();
You're getting errors cause you're casting returned objects into incorrect data type. Method .FindRow() returns a "FXCore.RowAut" not integer.

Hope it helps,

Cheers
Reply With Quote
  #5 (permalink)  
Old 11-03-2009, 01:55 PM
Member
 
Join Date: Jul 2009
Posts: 41
Kalzenith is an unknown quantity at this point
thanks for the reply yeah i figured out how the findrow() function works, unfortunately the row is not what i need, what i needed was the row number that the data was found on, the way i did that was just by querying each row individually in a for-loop statement.. not what i was hoping for but it worked, and in one line of code too.

Last edited by Kalzenith; 11-03-2009 at 02:03 PM..
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.

All times are GMT -5. The time now is 11:47 AM.
Copyright ©2009 Daily FX. All Rights Reserved.