Libreoffice Writer: Macro can't get the value of a table control

publishwrong.odt (11.5 KB)

I can’t seem to get this code to work. I’ve done things that on the surface seem more complicated (number sorting, login systems) so I’m not a complete novice with programming but I always get an error of some sort whenever I try to access data in the table column.

Also: is there anything I can read up on that would tell me how to make calls to a base database with macros?

I would appreciate the steps used to solve the error where it says FSVALUE2 is not found. Also, does FSVALUE2 have any properties other than GETINT, so that I might get text as well? Does it matter if the form is in design mode or not?

Have you installed one of the erxcellent object inspection tools: XrayTool, MRI? You can list the existing peoperties and methods of the programming objects by an object inspection tool.

Hello,

This question is actually a continuation of this post > How to get selected row from table control (also: refresh the query)? .

There I presented a link to a sample which totaled selected fields. Also showed in a comment the field names of the database used and one of them is FSVALUE2. It is a field in the table:
Screenshot at 2022-04-03 12-38-55
.
Your provided sample and question refers to this Field name but nowhere do you present your database table you are using. This is where you should be getting the name from or by examining the Columns in the basic IDE window as shown in the previous post > oForm watch window
.
getInt() is used because the field type is an Integer
.

This is solved by replacing FSVALUE2 with the field name in the table you are using.
.
Edit:
After some time now, it occurs to me that your last post about this may have been misleading. I was under the impression you could not get the sample to work and thus getting the error. Now I am thinking you simply copied the code to your project. That is hardly ever going to work especially in Base. There are too many variations in Base such as form names, control names, table names, field names, etc.
.
When getting a macro that works already, I work at understanding the code so I can fit it into my environment. It is difficult to provide any one place for documentation. Here are some:
Links in > To learn LibreOffice Base are there introductions or tutorials?
.
and
.
Andrew Pitonyak’s OpenOffice Macro Information
and
LibreOffice 7.3 SDK API Reference
.

Using a tool such as MRI or XRay is critical for drilling into the Properties, Methods, Interfaces and Services.
.
Yes it is a lot and again, documentation is scattered and not always complete.

Did you install MRI?
Did you read the MRI tutorial?
Then download this t76034.odt (15.4 KB) and click the table control.