🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.objectpascal
1 messages
1 total messages Started by devotionguy Mon, 01 Jan 2007 12:43
problem with Dynamic Array
#161
Author: devotionguy
Date: Mon, 01 Jan 2007 12:43
75 lines
3512 bytes
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;
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads