BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem with Dynamic Array

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal
View previous topic :: View next topic  
Author Message
devotionguy@gmail.com
Guest





PostPosted: Mon Jan 01, 2007 6:43 pm    Post subject: problem with Dynamic Array Reply with quote



hi friends
here i am sending a problem that......there is a List of Instrument as
array.
and every instrument has symbol and other properties.the combination of
all properties is a Instrument.and many instrument can have same
symbol.now according to that Every symbol i have to make a list of
Instruments.and for a same symbol we have to make an array of
Instrument with length of 10 at a time for making a group of 3
consecutive instrument..............
like

Suppose a Symbol...TCS ..and total 45 Instruments that means 45
Instrument have Symbol TCS
and i have to make a array of all the 45 Instruments....10+10+10+10+5
...in this way the setLength work....and in this set of 10
Instruments...all the 10 will make a group of 3 Instrument.......that
is1
1,2,3..2,3,4..3,4,5..4,5,6..5,6,7..7,8,9..8,9,10...
I am sending my code...plz help me to solve this problem
-----------------------------------------------------------------------------------------------------------------------------------------------
procedure TButterflyView.FormCreate(Sender: TObject);
var
Query,Symbol: string;
Token: array of Integer;
I,J: Integer;
Instrument: array of TInstrument;
List: array of array of TInstrument;
begin
inherited;
MasterData := TFOMaster.Create();

Query := 'select TOKEN from %s where INAME like ''OPT%%'' order by
SYMBOL,STPRICE,OTYPE';
with MasterData.ExecQuery(Query) do
begin
try
First;
I := 0;
SetLength(Token,RecordCount);
while not Eof do
begin
Token[I] := Fields[0].AsInteger;
Inc(I);Next;
end;
finally
free;
end;
end;
try
SetLength(Instrument,Length(Token));
I := 0;
while I<=Length(Token) do
begin
Instrument[I] :=
MainForm.NSEFuturesMarket.FindInstrument(Token[I]);
Inc(I);Next;
end;
finally
free;
end;
I := 0;Symbol := '';
// Symbol := (Instrument[I] as TFOContract).Symbol;
if I<=Length(Instrument)-1 then
begin
if Symbol=(Instrument[I] as TFOContract).Symbol then
begin
if (I>-1) and (J>0) then SetLength(List[I],J);
if I>=Length(List) then SetLength(List,I+10);
Inc(I);J := 0;
if J>=Length(List) then SetLength(List[I],J+10);
List[I][J] := Instrument[I];
Inc(J);
end else Exit;
end;
end;
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.