You’re right, John. When I re-open the document, the table has another reference, and WP SELECT doesn’t work anymore…
Is there any other way to get the object reference for a table in a 4D Write PRO document? WP Get selection doesn’t seem to work for table objects: $WPRange:=WP Get selection([_10_Report_templates]Template_WRPRO) WP GET ATTRIBUTES($WPRange;wk start;Start) WP GET ATTRIBUTES($WPRange;wk end;$end) WP GET ATTRIBUTES($WPRange;wk type;$type) WP GET ATTRIBUTES($WPRange;wk table id;$tblid) wk type always returns 0, and an error is returned when getting the wk table id … no matter what I select in the document. Rudy Mortier Two Way Communications bvba > On 11 Jul 2018, at 00:30, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Try putting the collection in a c_object and store the c_object in an > c_object field, or put the collection directly into the c_object field > > I am assuming that $tableObj is the object reference to the table. If tables > are anything like images, your plan might not work. Each time a document is > opened any images in the document gets a new object reference. If that is the > case with tables, your stored references will not work. > > John > > > > John Baughman > 1331 Auwaiku Street > Kailua, Hawaii 96734 > (808) 262-0328 > john...@hawaii.rr.com > >> On Jul 10, 2018, at 11:45 AM, Two Way Communications via 4D_Tech >> <4d_tech@lists.4d.com> wrote: >> >> I love the concept of tables in 4D Write Pro. >> >> You can only add or change them by code, which is fine by me for the moment. >> But what to do if a table has been created, and, in the 4D Write Pro >> document, you would want to add a column, or a row? Or change the width, the >> borders etc? >> >> Apparently there is no way to select the table object. I have tried WP Get >> selection, but that doesn’t work for tables. Or maybe I am missing something. >> >> I found out that I can select the table again (in code) using WP >> SELECT($tableObj). So, as soon as I have created the table in code, I copy >> the table object in a collection. (Yes, I am using deep copy) >> I do that for every table created in the 4D Write Pro document. >> When I save the record, I put the collection variable in a blob (VARIABLE TO >> BLOB), so I can retrieve the objects again. >> >> When I open the record, I read the collection from the blob (BLOB TO >> VARIABLE), but OK returns 0, and the collection variable stays empty. >> >> Here’s the code: >> >> C_COLLECTION(c4WRTableCollections) >> c4WRTableCollections:=New collection >> BLOB TO VARIABLE([_10_Report_templates]Blob_4WR_tbls;c4WRTableCollections) >> >> >> >> Any idea why it’s doing that, and how one could create a table in a 4D Writw >> PRO document, save it, open it again, and edit the table? >> >> >> >> Regards, >> >> Rudy Mortier >> Two Way Communications bvba >> >> >> ********************************************************************** >> 4D Internet Users Group (4D iNUG) >> FAQ: http://lists.4d.com/faqnug.html >> Archive: http://lists.4d.com/archives.html >> Options: https://lists.4d.com/mailman/options/4d_tech >> Unsub: mailto:4d_tech-unsubscr...@lists.4d.com >> ********************************************************************** > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************