Problem with bulk data addition to datastore

I added a small script ot add multiple entries to my “Addresses” project (see below). It simply loops through creating an array of data, then bulk adds it.

With the first try (repeat with i = 1 to 2) this worked fine.
The next try (repeat with i = 3 to 1000) failed, witht he following error dialog.

. Error code 1008 : Unprocessable entity : Validation error.

Script was:

on mouseUp
– put datastoreGetDataOfCollection(true,false,“Addresses”) into tRecs
– repeat with i = 1 to 2
repeat with i = 3 to 1000
put format(“A%06d”, i) into tArr[i][“First name”]
put format(“B%05d”, i) into tArr[i][“Last Name”]
end repeat

datastoreBulkCreateNewRecordInCollectionWithData “Addresses”, tArr, the long id of me, “onBulkCreated”

end mouseUp

on onBulkCreated
breakpoint
end onBulkCreated

Duh!. Sorry - my fault.

The script is wrong - “repeat with i = 3 to 1000” creates an improper indexed array

Changed the script to say (e.g.)

repeat with i = 3 to 1000
. put format(“A%06d”, i) into tArr[i-2][“First name”]
put format(“B%05d”, i) into tArr[i-2][“Last Name”]
end repeat
(Note the i-2 array reference !!

Sorry again - please ignore !