Sid
Sid

Reputation: 765

Powerbuilder Passing a Datastore / object

i have a datastore that when retrieve and has results, the rows should be displayed in another window

ds_1.Retrieve()

IF ds_1.RowCount() > 0 THEN

i_str_pass.po[1] = ds_1

OpenWithParm(w_error, i_str_pass)

END IF

i_str_pass is a structure and po is a powerobject

i want to display the results of ds_1 in w_error's datawindow without needing to retrieve it again

i tried calling in w_error

str_pass i_str_pass

i_str_pass = Message.PowerObjectparm

dw_1 = i_str_pass.po[1]

i debugged and saw that I passed it correctly but the data that was retrieved were not showing at all anything im doing wrong? thanks in adv.

Upvotes: 0

Views: 6084

Answers (2)

Jim O'Neil
Jim O'Neil

Reputation: 23764

Use

i_str_pass.po[1]. DYNAMIC ShareData(dw_1)

instead of

dw_1 = i_str_pass.po[1]

Surprised the latter wasn't a runtime error, since you're assigning a DataStore to a DataWindow.

GetFullState/RowsCopy is all fine too, but incurs a memory penalty since you're making a copy of that data (which may or may not be something you're concerned about)

Upvotes: 3

Seki
Seki

Reputation: 11465

You could take a look at GetFullState()/SetFullState() :

blobl lbl_data
if i_str_pass.po[1].GetFullState(lbl_data) = 1 then
    dw_1.SetFullState(lbl_data)
end if

You could also take a look at ShareData() to establish a "link" between 2 DataStores or DataWindows.

Upvotes: 1

Related Questions