[Solved] Column of a text table to an array

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

[Solved] Column of a text table to an array

Postby longi » Wed Jul 16, 2014 12:20 am

Hi guys! (sorry....and girls!)

I've been wasting my patience lately trying to convert a column from a text table into an array by macros.
It is supposed that the column could have a different number of rows, deppending of the source of that table.
I think it should be easy, and I am sure that lots of people wrote about it, but I didn't find a correct way.

I have to apologize because I'm writing this kind of question in this forum, but I want to use this trick to make a graph into a report...., but this is other thing.

If someone have the answer I would be happy to test it.

Thanks in advance!
Last edited by longi on Mon Jul 21, 2014 7:36 am, 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: 109
Joined: Mon Jul 15, 2013 5:04 pm

Re: Column of a text table to an array

Postby MTP » Wed Jul 16, 2014 5:41 pm

What do you mean by "text table" - is this a file you have connected to Base? A table inside Base? Something else?

And what do you mean by "array"? Could you upload an example of an input file and a mock-up of how you want the end result to look?
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
User avatar
MTP
Volunteer
 
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Column of a text table to an array

Postby longi » Wed Jul 16, 2014 7:15 pm

Well, my language skills are poor:
I have a report wich have a 'main table', wich is made by the Legacy Report Builder. After it I got to put a new paragraph, then a new table, which has data from a query. After this table I put one another paragraph, and finally a graphic, which represents the data from the new table, (or the data from the query).
I have all right except the array which shows the noum of columns in the graphic. So, I need to put into an array the data which are in the column of the new table (noums of bars) or to get this data from the query which is the source of the new table:

oChartDoc.Data.setRowDescriptions(Array())

This is the array I need.

Ah! I wrote about a text table because a report is a writer document, and I am trying to manipulate it in edit way by macros....
I hope you undestand me!
I've also write in the Spanish forum at the same time I asked for other related question.

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

Re: Column of a text table to an array

Postby MTP » Wed Jul 16, 2014 7:37 pm

OK, so I think I understand:
You are working on a macro. The macro works with a table in a Writer document (a Base report). The macro needs to create an array with a size equal to the number of columns in this Writer table.

So, you either need a way for the macro to ask Writer how many columns, or, a way to get the number of columns from the query the table is based on.

I don't know about the first method; maybe you could download the "OpenOffice.org Macros Explained.pdf" document from Andrew Pitonyak's site. He has a lot of examples of macros with Writer.

The second method might be easier. Would you post your query and explain what part you need to count?
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
User avatar
MTP
Volunteer
 
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Column of a text table to an array

Postby longi » Wed Jul 16, 2014 9:52 pm

Well, I've just prepared a simple version of my database.
I have one other more interesting, but I can't send it because the wheight...
In this one you have a very simple report that you can open directly to see how it was made by the "Legacy Report Builder"
If you open it with the macro, you'll have a report a bit different, and with a "new table" and a graph.
That I want is to fill automatically the array which is in the fiveth line of the macro (starting from the end of it), because in the graph we get the noum of "CONCELLOS" above each bar of the graph.
This information exists in the query (line 15 of the macro), and also into the "new table".
This "new table" was apparently split into two parts only for fun or practice, but we can put it into only one in order to get data which are in cells we want.
I hope to be clear.
Ill try the other exemple, but I'm afraid it could be impossible.

thanks so much because your interest.

Good day!
Attachments
FORMATO MONOTABLA.7z
(53.96 KiB) Downloaded 90 times
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 109
Joined: Mon Jul 15, 2013 5:04 pm

Re: Column of a text table to an array

Postby longi » Thu Jul 17, 2014 9:05 am

I have to apologize.....Instead "CONCELLOS" I wanted to write "COMARCAS".
Also I simplified a bit the macro and in this new version you have two macros: one of them is ended in "0" and the other one in "1".
The "0" is the simpliest, and I tried to translate the notes that I put to clarify things. In this macro the new table is not divided, to see things in an easier way.

Thanks!
Attachments
FORMATO MONOTABLA2.rar
(54.43 KiB) Downloaded 93 times
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 109
Joined: Mon Jul 15, 2013 5:04 pm

Re: Column of a text table to an array

Postby longi » Thu Jul 17, 2014 10:50 pm

hI!
Finally I got to reduce the other data base in order to show how it works with more than one table (sort fields ). Maybe it could be easier to understand the need I exprexed previously, and in this case the column is "CONCELLOS", as I wrote before.

Thanks!
Attachments
FORMATO MULTITABLA.7z
(84.72 KiB) Downloaded 97 times
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 109
Joined: Mon Jul 15, 2013 5:04 pm

Re: Column of a text table to an array

Postby MTP » Fri Jul 18, 2014 4:28 am

That... is a very complicated macro.
Maybe the attached file works better for you. Let us know.
Attachments
FORMATO MULTITABLA (revised).odb
(88.92 KiB) Downloaded 154 times
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
User avatar
MTP
Volunteer
 
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Column of a text table to an array

Postby longi » Fri Jul 18, 2014 10:32 pm

Hi!
I'm glad to have had your help. The macro works correctly.
As I had to reduce the number of records (from 16500 to 1500) in order to reduce the weight to get send it I realized that one area didn't have any results from the query, but it was made a header of the subtable and a graph with the same data as the previous graph. This is fixed without problems. Also I used your solution in the other version of the macro, with a one-table-report. And also works.
Next step is how to manipulate the text that you help me to put into the graph.(less height of the font letter, and to put it with some angle )...but It could be later...
The macro started simplier than now, only for fun, and trying to get some tools to design reports, because this is a subject underdeveloped (I think). Then I was adding new parts each time..., but if you uses one tool after other, step by step, you will get a complex macro, but it is like a building: brick after brick, and finally you have a good result.
When I started with reports ( I have to say that I have no idea about programming ), I got to manipulate large texts, with alignement, and then I got graphs, which normally it is said that are not possible in reports. Then I am trying to get a subreport, and this macro, is not a subreport, but it seems to be one....
Thanks for your help!
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 109
Joined: Mon Jul 15, 2013 5:04 pm

Re: [SOLVED]Column of a text table to an array

Postby longi » Mon Jul 21, 2014 7:35 am

Sorry!
I forgot that I had to put the marvelous word 'SOLVED'.
Thanks so much!
OpenOffice 4.1.5 on Windows 10
LibreOffice 5.1 on Windows 7
LibreOffice 6.0.1 on Windows10
longi
 
Posts: 109
Joined: Mon Jul 15, 2013 5:04 pm


Return to Reporting

Who is online

Users browsing this forum: No registered users and 1 guest