Page 1 of 1

TIBCArray and GetArray

Posted: Mon 11 May 2009 06:48
by SeaCay
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

Posted: Tue 12 May 2009 08:15
by Plash
Do you get 150 from ArrayHighBound[0] or ArrayHighBound[1]?

Posted: Sun 17 May 2009 05:10
by SeaCay
Hello Plash

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

regards

SeaCay

Posted: Mon 18 May 2009 07:11
by Plash
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.