TIBCArray and GetArray

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SeaCay
Posts: 26
Joined: Wed 10 Jan 2007 03:03

TIBCArray and GetArray

Post by SeaCay » Mon 11 May 2009 06:48

Hello Support

IBDac 2.70.0.43
Delphi 2009

I have some code

Code: Select all

procedure loadPoints(aDs : TIBCQuery);
var
fbArray : TIBCArray
ptKount : Integer
ptsArray : Variant

begin
...
  fbArray := aDs.GetArray('POINTS');
  ptKount := aDs.FieldByName('NUMPOINTS').AsInteger;
  ptsArray := fbArray.GetItemsSlice([1, 2, 1, ptKount]);
...
which gets called multiple times by a user clicking a "Next" button.


the first line of code fails when looping through the dataset when the number of array entries exceeds the first time fbArray is set.
For example
On the first pass (1st record in ds) there are 6 array elements to identify
On the Second pass (2nd record in ds) there are 4 array elements to identify
On the Third pass (3rd record in ds) there are 10 array elements to identify.
It is at this 3rd point I get an exeption error message:
Array high bound out of bounds (10)
When I check the fbArray High Bounds property, it is 150 which is what I would expect for my app.

I suppose I am doing something wrong :( but after two days of looking, I cannot detect the problem.

Please can you advise how to do this properly.

Thanks and regards

SeaCay

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 12 May 2009 08:15

Do you get 150 from ArrayHighBound[0] or ArrayHighBound[1]?

SeaCay
Posts: 26
Joined: Wed 10 Jan 2007 03:03

Post by SeaCay » Sun 17 May 2009 05:10

Hello Plash

Your question
Do you get 150 from ArrayHighBound[0] or ArrayHighBound[1]?
The answer is ArrayHighBound[1]

regards

SeaCay

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 18 May 2009 07:11

We could not reproduce the problem. Please send to ibdac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Post Reply