Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array of datastores

Status
Not open for further replies.

tinac99

Programmer
Jan 17, 2002
58
US
is it possible to create and access an array of datastores? I have the following scripts in my window:

* Instance variable : datastore ids_detail[]

open event
==========
for i = 1 to 2
ids_detail = Create datastore
ids_detail.dataobject = 'd_sample1'
ids_detail.settransobject(sqlca)
next

buttonclick
===========
for i = 1 to 2
ls_sql = ids_detail.Describe("Datawindow.Table.Select")
next


------------------------
so far, it's doing everything as expected with the first element of the array, but it's returning an empty string on the describe statement of the 2nd second datastore. Also, in the debugger, it shows that the dataobject has been assigned to the 2nd datastore, but it does not enter in the following condition:
if ids_detail[2].dataobject = 'd_sample1' then
:
end if

I would appreciate any input, comments and suggestions.

Thank you.
 
It is perfectly possible to create and access an array of datastores. We have an application having more than 300 screens where in all of them we have arrays of datastores and we have not faced any such problems.

I think there is some problem in the code. Maybe there is some code between open event and the button click event which is creating mischief. Try one thing

In the open event, add this code also (which is in buttin click) after the initialisation loop.

for i = 1 to 2
ls_sql = ids_detail.Describe("Datawindow.Table.Select")
messagebox(string(i)+'>>'+ids_detail.dataobject,ls_sql)
next

and see if it displays data as expected.



RT
 
Tried that one and the second datastore is not retrieving the SQL.
But, I got it working. My dataobject was passed on from another window and it had a space(' ') before the actual name, that's why it looked ok when I looked at the value in the debugger.
Thanks for your input.
 
I've run across this before.

You should check the return code from the SetTransObject to see if you got a good datawindow object assignment.

If the datawindow doesn't exist (ie. is 'mispellet' or the PBL got dropped from the libary list) SetTransObject will fail.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top