on 11-28-2012 8:46 AM
Hello,
pb 11.2
I try to insert row in dw which is located in nested dw and I get error. What is wrong with this syntax?
Regards
Tomaz
Is "dw_izsave" the name of the report objects as you have stored it in a pbl or
is "dw_izsave" the name of the report control in your main report?
You have to use the nested report's control name.
Try to use getchild () and then an InsertRow() on that child.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tomaz;
Make sure that the DWO is really a "Nested" type. If its a "Composite" (which may look identical) - the GetChild ( ) method is not supported and the command will fail.
Good luck!
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ouch!
The only way to add information in a Composite style report is using the DOT notation. Its a little harder to use but the saviour here is the SQLSyntax utility that can be launched from the PB IDE in the File => New => Tool menu/tab sequence. The DOT notation can only copy data but should suffice in your case.
If for example you have a Composite DWO named "dw_comp" and a child DWO inside that called "dw_tomaz" then here is what the basic syntax would look like if you were loading the child DWO's primary buffer from a working DataStore ...
dw_comp.Object.dw_tomaz.Object.Data = DS..Object.Data
Note1: You might want to wrap this in a TRY.. CATCH as a DOT notation failure will cause a run-time error cascade
Note2: DOT notation is not dynamic and cannot be used in a generic loop
HTH
Regards ... Chris
PS: Please vote on enhancement #3686 to have GetChild ( ) method support added to nested DW's!
Chris,
I am not sure about your statement...
This is nice Article about Datawindow Reporting.
Thanks Arnd;
Great tip in the article on changing the DWO's Composite to Nested gender!
FYI: This code works for me ....
DataStore lo_ds
lo_ds = CREATE DataStore
lo_ds.dataobject = 'dw_test2'
lo_ds.SetItem (1, 'name', 'Chris Pollach')
lo_ds.SetItem ( 1, 'phone', 6135551234)
dc_comp.Retrieve ()
// Load data into a nested DWO inside a Composite DWO.
dc_comp.object.dw_2.object.data = lo_ds.object.data
Regards ... Chris
PS: Article states you can not use a getchild () on a composite DWO and then later says you can. I think that author got a little confused in the latter part. Otherwise ... a good synopsis of child DWO's inside a parent DWO.
Hello Chris,
your solution (dc_comp.object.dw_2.object.data = lo_ds.object.data) work if dc_comp have only on row,
if it has more rows it returns error 39, Error accessing external object property object at line....
if I try solution from Arnd Powerbuilder just crash.
Any other option?
Regards
Tomaz
Hi Tomaz;
This works perfectly for me in PB 12.1!
Here is the modified test code I just used ...
DataStore lo_ds
lo_ds = CREATE DataStore
lo_ds.dataobject = 'dw_test2'
lo_ds.InsertRow (0)
lo_ds.SetItem (1, 'name', 'Chris Pollach')
lo_ds.SetItem ( 1, 'phone', 6135551234)
lo_ds.InsertRow (0)
lo_ds.SetItem (2, 'name', 'Thomaz Kralj')
lo_ds.SetItem ( 2, 'phone', 6135554321)
lo_ds.InsertRow (0)
lo_ds.SetItem (3, 'name', 'Bruce Armstrong')
lo_ds.SetItem ( 3, 'phone', 6135559999)
dc_comp.Retrieve ()
dc_comp.object.dw_2.object.data = lo_ds.object.data
Regards ... Chris
I do not have any because the parent DW is a "Composite" type - therefore, only each child DWO potentially has rows of its own. In my test Composite's case, the child DWO "dw_2" has zero as I expected (used a NULL row in the DW's buffer). So now I start to populate a DS containing the same DWO as used in the Composite with data (of course you can do a retrieve here too instead).
Now that the DS's DWO has a proper primary buffer, I copy the primary from the DS to the Child DW's in the Composite ... et voilà - data appears! 🙂
That's no problem ... just change your (my) code to:
Long ll_row
lo_ds.object.data = dc_comp.object.dw_2.object.data // Get data
ll_row = lo_ds.InsertRow (0) // Add to it
lo_ds.SetItem (ll_row, 'name', 'Chris Pollach')
lo_ds.SetItem ( ll_row, 'phone', 6135551234)
dc_comp.object.dw_2.object.data = lo_ds.object.data // Put it back!
- OR -
a) Use a RETURN +2 on the RetrieveStart of your DS
- preserves the DW's primary buffer)
- adds new rows to the current data
b) Now use the DS.Retrieve () instead of the InsertRow's. 🙂
HTH
"Kool" ... n'est pas?
So, my dw_comp could have more than 1 row (it has select statement) and in this dw_comp I inserted report dw_report. If dw_report return after retrieve just 1 row than dc_comp.object.dw_report.object.data = lo_ds.object.data WORKS!
But if dw_comp has more than 1 row then dc_comp.object.dw_report.object.data = lo_ds.object.data DOESN'T WORK!
It returns error 39, Error accessing external object property object at line....
I have no idea how to solve this
Regards
Tomaz
Hi Tomaz;
May I suggest:
1) Create a simple Composite DW and 1-2 child DWO's inside it.
2) Create a simple test application for the composite DW.
3) Upload the test application to the NNTP Sybase PB news group (this forum is useless for these such things).
That way, we can look at your DW construction and provide some expanded code that should demonstrate the approaches mentioned (or even expose a few more <bg>).
Regards ... Chris
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.