Hello!
I'm aware of the technique of rowset and have used it to read database data using RowSet.getstring(N).
I'm sure I've seen somewhere that it's possible to retrieve column data by column name. This is more maintainable, obviously.
Having a bit of a head-wall-bang issue here trying to locate said stuff in the documentation, AOO, Pitonyak, google, stackoverflow etc.
So, any tips or bits of code would be welcome!
to recap: retrieve database rows and process each row using column name
Thanks in advance
David
[Solved] A bit of help with get column by name
[Solved] A bit of help with get column by name
Last edited by misitu on Wed Nov 16, 2016 2:41 am, edited 1 time in total.
OpenOffice 4.1.1
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
Re: A bit of help with get column by name
Why don't you use MRI?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: A bit of help with get column by name
Because I do not understand how using MRI will help answer my original question.
Thanks...
Thanks...
OpenOffice 4.1.1
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
Re: A bit of help with get column by name
MRI shows clearly that there is no method to get a column by name. There is a method findColumn(name) to get the column number by name. Nobody knows all that shit by heart. We all look it up with MRI or Xray.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: A bit of help with get column by name
Why didn't you say that in the first place ...
My question was to be able to reference a column by name, which you just told me is possible.
What I would like to do is return my resultset "select * from ViewXXXXXX" and take each column and use as a field master.
Obviously, this can be done by getstring(n), and equally obviously I can structurally link n with its name using
This is all possible. I'll have to go this way but was hoping for something a bit more elegant, taking the database column name and using that as part of the field master name structure.
Before we start talking templates again, I can't go down that road because it hard codes the registered name into the database name part of the field master, and as I want to substitute that at run time that won't fly. In fact it won't even hatch.
David
My question was to be able to reference a column by name, which you just told me is possible.
What I would like to do is return my resultset "select * from ViewXXXXXX" and take each column and use as a field master.
Obviously, this can be done by getstring(n), and equally obviously I can structurally link n with its name using
Code: Select all
col=Result.Columns.getByIndex(I)
colLabel = String(col.DisplaySize, "*")
LSet colLabel = CStr(col.Name)
Before we start talking templates again, I can't go down that road because it hard codes the registered name into the database name part of the field master, and as I want to substitute that at run time that won't fly. In fact it won't even hatch.
Edit: Yup. End of Road. It seems after all that resultset..getstring(N) is the simplest way to go. Thanks. |
OpenOffice 4.1.1
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic
HSQLDB 2.3.4
Windows 7 HP / Windows 10
OOBasic