[Solved] Header of a query to an array

Getting your data onto paper - or the web - Discussing the reports features of Base

[Solved] Header of a query to an array

Postby longi » Fri Sep 05, 2014 9:33 am

Hi!
I've just read something I wrote, and I'm embarrased because my mistakes with the language.....

Well, few days ago I wrote a post about 'Column of a text table to an array ', and it was answered quickly and it works properly, but now, to improve one macro I need to use the textfield nouns from a query in an array (in this case is to get the noun of the series that a chart has, and the chart is based on a query - see '[Solved] Multiseries chart in reports '-)

I hope you can understand me.

Thanks in advance!
Last edited by longi on Sun Oct 19, 2014 11:36 pm, edited 1 time in total.
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 108
Joined: Mon Jul 15, 2013 5:04 pm

Re: Header of a query to an array

Postby longi » Sun Sep 21, 2014 5:11 pm

Hi again!
Well, it seems that this is not the correct subforum. I sorry because I didn't expressed correctly:
It is a question related with reports, I'm trying to build a report with a query inside it, and I need to put into an array all textfields nouns, to automate a part of the report. Now I'm filling it by hand.
A little example:
If the query inside the macro is: "SELECT ""CONCELLOS"",COUNT( ""REGA"" ) AS ""EXPLOTACIONES"" FROM ""CONCELLOS""", I need an array with these elements: (CONCELLOS,EXPLOTACIONES), which are the header of the query.
I've been using a result set to get the result of the query to make a new table into de report, but I can't use the header of the query to put the header of the new table in the report, so, I have to write it by hand.
I think that the wizard to make forms or reports, in its first step, you have a listbox to choose the table or query as the source of data, and below it we can choose fields, because the other listbox have the noun of fields of the table or the query has. So, I think it is possible, but I don't know how to do.
I would be happy if someone knew how to do it.

Thanks in advance!
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 108
Joined: Mon Jul 15, 2013 5:04 pm

Re: Header of a query to an array

Postby longi » Sun Oct 19, 2014 11:35 pm

Hello!

Thanks to Pitonyak's advices I got the solution: The trick was that I have to deal with Metadata of query:

k=0
Dim ColumnArray()
for i=2 to Columnas
Redim Preserve ColumnArray(K)
ColumnArray(K) = oMeta.getColumnName(i)
K = K+1
next

With this code all works properly.

Thanks!
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 108
Joined: Mon Jul 15, 2013 5:04 pm


Return to Reporting

Who is online

Users browsing this forum: No registered users and 2 guests