[Solved] Help with queries and forms

Discuss the database features
Post Reply
mialau
Posts: 2
Joined: Thu Jun 30, 2022 4:55 pm

[Solved] Help with queries and forms

Post by mialau »

Hello! So, I am supernew to OpenOffice base and I need some help.

I want to make some forms so that the are easy to use by the users, insert a new row in the database, etc.

The one thing I'm having problems with is the queries in a form.
I want the user to be able to select a dropdown from one of the related tables and get back the data just from the selected option in the dropdown and I have no idea how to do that tbh. If you could help me!

Thank you so much, I'll attach the DB (it's just a simple example so that you can help me solve the problem)
Attachments
Club.odb
(3.28 KiB) Downloaded 80 times
Last edited by mialau on Mon Jul 04, 2022 2:25 pm, edited 1 time in total.
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Help with queries and forms

Post by UnklDonald418 »

Look at the Example Form in the attached .odb file
It uses a ListBox to select/display the "currentPlacement"

Open the Form in the Edit/Design Mode
Right click on the column CurrentPlacement and select Column to open the Listbox Properties dialog.
On the Data tab the List content contains the query.

Code: Select all

SELECT "currentPlacement", "idPlacement" FROM "Placement_TABLE" ORDER BY "currentPlacement" ASC
ListBox queries take the general format of

Code: Select all

Select "Display Field", "Bound Field" From "Some Table"
The ORDER BY clause is optional and probably not needed since you only have 5 choices.

"Bound Field" is the integer value corresponding to the "Display Field" in "Some Table"

Club01.odb
(11.95 KiB) Downloaded 97 times
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
mialau
Posts: 2
Joined: Thu Jun 30, 2022 4:55 pm

Re: Help with queries and forms

Post by mialau »

Hello! But now I can see where I can just show in the List the data that is currently in the DB table, but I can't see how to still do what I want to do.

What I meant is that when the user opens the form, it will have that List Content where every single currentPlacement is displayed and when you select one it shows me a table with the results for that one, for example Winger

Thank you so much
OpenOffice 4.1.12 on Windows 10 / MacOs 12.4
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Help with queries and forms

Post by UnklDonald418 »

What I meant is that when the user opens the form, it will have that List Content where every single currentPlacement is displayed and when you select one it shows me a table with the results for that one, for example Winger
That can be accomplished with a simple Form and SubForm.
Here is a link to a Base User Manual https://documentation.libreoffice.org/a ... eGuide.pdf

In your main database window select Forms >Use Wizard to Create Form
From the 1st page of the Form Wizard select Table: Placement_TABLE
Add both of the Available fields to Fields in the form
Next to get to page 2 of the wizard.
Check Add Subform then Subform based on existing relation and select players
Next to get page 3 of the wizard and add all the Available Fields to Fields in Form.
Next should take you to page 5 of the wizard.
For this use Table controls (the wizard will display as Data Sheet) for both main form and subform
Next to get page 6 of the wizard
Next to accept the defaults on page 6 and move to page 7 of the wizard
You can use the default or pick a different color combination for your new form.
Next to page 8 of the wizard
You can use the default or type in a new Name of the form
Check Work with the form
select Finish
the new form will open.
select a placement in the upper table and the lower table will display all players with that placement.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Help with queries and forms

Post by Villeroy »

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
Post Reply