About  Usage  ADOxtra  Common  Connection  Recordset  Field  Property

ADOxtra known problems

"Repeat with listItem in some List" problem

Problem:

Using rst.Fields[fieldIndex]=newValue or rst.Properties[propertyIndex]=newValue inside list enumeration loop: repeat with listItem in someList breaks the loop right after the first iteration with Lingo error "Script error: List expected for handler repeat with listItem in someList #getAt". For example following loop will execute only once:
testList=[1,2]
repeat with listItem in testList
  rst.fields["Int_Field"]=2 -- It does not neccesary to actually use listItem here
end repeat

Note, only setting object.someProperty[index] property inside loop affects the behaviour of the repeat in list loop.
Tested with Director v7.02, v8.0 for Windows.

Reason

The same problem occures without ADOxtra. It seems to be a Director bug. To reproduce the problem it is enough to set member(1).char[1]="a" inside repeat in list loop. Where member(1) is non empty text cast member.
testList=[1,2]
mem=member("someTextMember")
repeat with listItem in testList
  mem.char[1]="a" -- Just using setting indexed property here
end repeat

This sample drives Director crazy without using ADOxtra.
Tested with Director v7.02, v8.0 for Windows.

Workaround

Use simple repeat loops:
testList=[1,2]
repeat with i=1 to testList.count()
  listItem=testList[i]
  rst.fields["Int_Field"]=listItem
end repeat

This sample works as expected.
Tested with Director v7.02, v8.0 for Windows.


©2001 Eugene Shoustrov www.adoxtra.com Built on April 4, 2001