Reputation: 24152
I've a list of say, clients, in my main window. The list displays just fine.
The list of clients is presented as a grid.
Now, I've another window to edit client details. Both the list and the detail have the same columns with same names. Only presentation defers as the detail datawindow is a free form. Another difference is that the list won't show all the client information data such as the address, for example. In order to read the address, the user needs to open up the detail window by double-clicking the row that represents the client.
So I wish to display the client information data from double-clicked row into this detail window so the user can view and edit the information.
Let's say I've a client.
Client
Id
GivenName
Surname
DoB
Address
City
StateOrProvince
ZipOrPostalCode
SpouseName
IsActive
LastUpdatedOn
CreatedOn
So the list of clients only displays:
Id
GivenName
Surname
IsActive
And have the other columns/attributes into the grid definition of the datawindow. They're only not shown on screen.
The detail window should allow the user to change the following:
GivenName
Surname
DoB
IsActive
SpouseName
Address
City
StateOrProvince
ZipOrPostalCode
Whilst also having all of the other fields which are not necessarily relevant for an edit.
So basically both dw have same number of columns and same column names.
I now try to pass the current client information data into the detail window as follows, on the list doubleclick event.
long ll_currentRow
datastore lds_currentClient
ll_currentRow=dw_clientList.getRow()
lds_currentClient=create datastore
lds_currentClient.dataObject='d_client_detail'
dw_clientList.rowsCopy(ll_currentRow,ll_currentRow+1,primary!,lds_currentClient,0,primary!)
openWithParm(w_clientEdit,lds_currentClient)
And then in the w_clientEdit.open event...
datastore lds_clientToEdit
lds_clientToEdit=create datastore
lds_clientToEdit=message.powerObjectParm
dw_clientDetail.dataObject=lds_clientToEdit.dataObject
lds_clientToEdit.shareData(dw_clientDetail)
And when the detail window shows up on the screen, I can see no information at all. And the both the lds_clientToEdit and lds_currentClient contain no rows at all.
Any clue as to what I'm doing wrong? It's been a long time since I haven't done such manipulation in pb. I'm a bit rusty.
Oh! And btw, I also tried to pass on the list datawindow as a parameter to the openWithParm function to have it passed as the parameter to the detail window. And even that, I wasn't able to make it work properly.
Upvotes: 0
Views: 746
Reputation: 395
It is much better in such a case to use the same data in both data windows, using the 'sharedata' function, without any need to copy.
In the 'doucle clicked' event:
long ll_currentRow
openWithParm(w_clientEdit, dw_clientList)
In the 'open' event:
...
datawaindow ldw_parm
ldw_parm = Message.PowerObjectParm
dw_clientDetail.shareData(ldw_parm )
dw_clientDetail.scrolltorow(ldw_parm.getRow())
Upvotes: 0