[Solved] Display and customize data source as table in form

Creating and using forms

[Solved] Display and customize data source as table in form

Postby mic45267 » Sun Sep 10, 2017 7:47 am

Ooo supports a feature, to display the data source of a form as a table in the top of the form. It seems to be similar to the split view feature of MS Access.
The user can activate the function by pressing the most right button in the navigation toolbar.

I would like to
  • display the table whenever I open the form
  • control the size of the table in my form
  • control which columns are displayed
  • control the order of the columns

How can I do this?
Last edited by Hagar Delest on Wed Sep 13, 2017 10:05 pm, edited 1 time in total.
Reason: tagged [Solved].
LibreOffice: 5.3.5.2
Mac: 10.12.6
mic45267
 
Posts: 9
Joined: Tue Aug 29, 2017 8:41 am

Re: Display and customize data source as table in form

Postby UnklDonald418 » Sun Sep 10, 2017 7:55 pm

When using Base the word Form can be confusing because it can have multiple meanings. When you open your database and select Forms what you see is a list of Form documents.
Each Form document can display multiple Forms, each with it's own data source and controls.
With a Form document open in the Edit/Design mode locate the Form Design toolbar usually found along the bottom of the Form Design window. Click on the Form Navigator found on that tool bar to display the Form Navigator dialog. At the top of the dialog right click on Forms and select New->Form and an empty Form will be added to the list.
Right click on the new Form and select Properties to get the Properties dialog. The Data tab on that dialog allows you to select a data source, which can be any table or query defined in your database.
Then you can add a table control to the new Form to display the data, Just like any other table control you can pick which columns and what order they appear as well as the size and location.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the subject line
Apache OpenOffice 4.1.4 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 590
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Display and customize data source as table in form

Postby mic45267 » Mon Sep 11, 2017 7:24 am

Ok, I have learned that I have not been precise enough. So I try again.
I have created a Base Form which displays the content of a record of an associated table using Controls, such as Text Fields, checkboxes, Listboxes.
I am using also the Base Form feature "Data Source as Table". And my questions has been related to the displayed table.
Any idea?
LibreOffice: 5.3.5.2
Mac: 10.12.6
mic45267
 
Posts: 9
Joined: Tue Aug 29, 2017 8:41 am

Re: Display and customize data source as table in form

Postby Arineckaig » Mon Sep 11, 2017 10:37 am

I am using also the Base Form feature "Data Source as Table". And my questions has been related to the displayed table.
In its early days Star Office, the predecessor of OpenOffice, had a feature known as the "beamer". I suspect the current GUI still makes use of some relic coding to display "Data Source as Table". It would probably require a macro starting with the StarDesktop service to change the selection and order of rows or columns to be displayed.

If the requirement is the automatic display of the Data Source Table, UnklDonald418's suggestion to add an extra data form to the form document is the simpler route: that data form containing a grid form control can readily be programmed to display and sort whatever rows or columns are required from the Data Source: in particular,
display the table whenever I open the form
control the size of the table in my form
control which columns are displayed
control the order of the columns
This added data form can be linked or not, as wished, to the other data form(s) contained in the form document.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
OOo 4.1.1 on MS Windows XP MySQL and HSQLDB
Arineckaig
Volunteer
 
Posts: 827
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Display and customize data source as table in form

Postby mic45267 » Mon Sep 11, 2017 1:02 pm

Thanks for the info.
I have already implemented a form using a table grid in the main form and a record detail view in the subform. This works well but I have to write the macros to take care of refreshing the table rows or the details form.
I am also not sure how to handle a situation where I have started to add a new row in the table grid and change a value in the detail form without inserting the new record first.
An example implementation would be very helpful. I will prepare a sample database for this use case. This will ease further discussions.
LibreOffice: 5.3.5.2
Mac: 10.12.6
mic45267
 
Posts: 9
Joined: Tue Aug 29, 2017 8:41 am

Re: Display and customize data source as table in form

Postby mic45267 » Mon Sep 11, 2017 9:26 pm

Now I found a proper solution. Instead of using a main and a linked subform (see example form ContactsWSubform), I have created a mainform with a table grid and txtFields connected to the same record fields. (see Contacts).
ExampleDB.odb.zip
Sample table grid with additional control details
(15 KiB) Downloaded 22 times

The form Contacts behaves exactly as intended: I can modify, add, delete records.

Thx for the discussion
LibreOffice: 5.3.5.2
Mac: 10.12.6
mic45267
 
Posts: 9
Joined: Tue Aug 29, 2017 8:41 am


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests