Page 1 of 1

[Solved] I can't insert data into Table Control

Posted: Mon Mar 27, 2017 8:03 am
by zenira
hi
I want insert "Example" string into "ColumnName" column in TableControl but I can't do it

Code: Select all

oTable=oForm.getByName("TableControl1")
oTable.insertByName("ColumnName","Example")
how can I do.
I can not find enough document about TableGrid how can be added data into it
Thanks for your help

Re: I can't insert data into Table Control

Posted: Mon Mar 27, 2017 7:05 pm
by UnklDonald418
Have you looked at this example?
viewtopic.php?f=100&t=36716

Re: I can't insert data into Table Control

Posted: Mon Mar 27, 2017 8:12 pm
by zenira
yes . I did but I did not understand

Re: I can't insert data into Table Control

Posted: Tue Mar 28, 2017 5:29 pm
by UnklDonald418
Yes, the OO API is complex and has a steep learning curve. Add to that the fact that the official documentation is opaque. On this forum the common recommendation is that to make full use of SQL and proper database design and rely on macro programming as a last resort.

It isn't entirely clear what you are trying to accomplish.
Are you sure you need a macro for this?
InsertByName() is used to programmatically add a new control to a form. Is that what you want?
Or are you trying to change the Column heading “ColumnName” on the table to “Example”?
Or are you trying to insert the string “Example” into a table cell in the column “ColumnName”?

Look here for a list of macro programming resources.
viewtopic.php?f=39&t=13396&p=64815&hili ... ide#p64815
Many of those are free downloads.
If you don't already have the macro programming documents from Andrew Pintonyak see:
http://www.pitonyak.org/oo.php
You also might find The Star Office Basic Programmers Guide helpful
https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide

One book I found particularly helpful was “Database Programming with OpenOffice.org Base & Basic” by Roberto Benitez.
http://www.baseprogramming.com/%20%20%2 ... urces.html

Re: I can't insert data into Table Control

Posted: Tue Mar 28, 2017 9:51 pm
by zenira
Thank you UnklDonald418, I appreciate your effort
Yes I want to add some value into grid, ColumnName is one of column names in grid.
I will study examples in your post.
Really thanks

Re: [Solved] I can't insert data into Table Control

Posted: Wed Mar 29, 2017 6:03 am
by UnklDonald418
OK, try

Code: Select all

oTable=oForm.getByName("TableControl1")
oColumn = oTable.getByName("ColumnName")
oColumn.Boundfield.updateString("Example")  
oColumn.commit