Base listbox basics - my first one not working

I see that there was an old topic in which someone had the same problem - listbox will not display list selections in the display field or transfer them to the supposedly linked field in the form’s main table. However, their problem was solved when they discovered that the two field datatypes were different. Mine are identical - text[varchar].

I’m using LO 7.1 on Windows 10.

Documentation is scattered and incomplete, so I’m missing something.
Please explain precisely how to set one up, starting with how the ‘linkage’ between list source table field and form linked field is established. What I did was:

  1. Start with a form linked to a table with text[varchar] field Text1. It is not a key of any kind. Does it need to be?
  2. I create a listbox, and fill in the form wizard. It correctly points to the list table, which has two fields:
    ID (primary key integer)
    textola (nonkey text field containing listbox entry text)
  3. I specify that Test1 and textola are linked. I have tried changing the Bound Field setting without luck, but I can’t figure out exactly what it does.

The listbox indeed contains all the entries from field textola, but won’t do anything with them when I select one.

Does there need to be a key relationship between Text1 and textola, or the ID primary key fields? The Wizard isn’t complaining that there isn’t.

Also, where’s the best place to go for such basic examples of Base useage, either in text or as sample databases? I managed to find one that shows how to put images into an Image Control, which was unexpectedly quite difficult-- it involved macros, and I never would have gotten it on my own. They’re hard to find just rattling around the 'Net. Examples really clarify discussion the best.

Thanks in advance.

Hi it will be much easy for people to help you if you upload an .odb file for testing.
Lots of great examples (like on listboxes) are in Base Guide, I think the latest one is 6.4, I am profitted so much from it. https://nextcloud.documentfoundation.org/s/Rt67sEsWtg4TQJR

Hello,

There is no one good source for Base documentation. Please see this post for a number of links → https://ask.libreoffice.org/t/to-learn-libreoffice-base-are-there-introductions-or-tutorials/21856

For examples there is this location → Apache OpenOffice Forum

As for your question, there is a lot to a list box and many methods to set it up. It appears you are dealing with SQL retrieving data from a different table. The list box is different from the combo box in that you can display one field and store a related field thus saving data storage space (ie: display name of city but store ID). An example of this can be found in this post → Update Record with Listbox Selection

There are many list box examples posted - use the search box (magnifying glass in upper right). That is how I retrieved this example. May take a bit of searching - just a few minutes for this one.

Also:

Don’t know what this is all about. Please see links in this post → I need some directions on creating database involving photos. Directions?

I take it your image control points to a text field in the form’s primary table. When I tried, scrolling through the already populated table did not display images.

I’ll check out combo boxes as an alternative. However, in most cases I only want the user (me) to select from an approved list, not also improvise input.

Did not mean you should use a combo box. In fact I typically stay away from them. The specific list in the list box is preferable.

Do not know what this is referring to:

If this is referring to the picture_links.zip file here → zip file, I just tested & it works for me on Ubuntu 20.04 with LO v 7.2.2.2

My form has a primary table with a text field containing paths to JPG files. I created an image control that listed that text field as its datasource, and set it all up, as best I could make out, from reading the Base Guide. I couldn’t get it to display images
as I scrolled through the primary table records. The control remained blank, no error messages or other behavior, just no images.

This link already given in my answer explains how to display linked images → How to insert a link to an odb database to display an image

Solved. Your sample showed me that the image control wants file paths in URL format. Changed DOS paths to URL paths and it works fine.
Now, on to mastering communications between controls.

The form wizard is pointless, partly because it never creates any listboxes. The recipe for 99% of all listboxes goes like this:
Having some foreign key (ID number) in your form, Ctrl+right-click the numeric field and choose Replace with → Listbox. In the properties of that listbox set property “Dropdown” to true.
On the data tab of the listbox properties:
Linked field: the foreign key in your form
Source type = SQL
Source: SELECT “Some Text” AS “Visble”, “PrimaryKey” FROM “Other Table” ORDER BY “Visible”
Bound field: 1 (which is the second field)
The listbox will map some visible text to the primary key of some other table and writes this primary key into the foreign key of your form.
If you use many such listboxes you may want to store the SQL in a query and use it with source type Query instead of SQL.

Ah, well, you mean it never creates working listboxes? It made me one, but all it did was display its dropdown list (which was correctly derived from the secondary table). Wouldn’t transfer selections to the display field.
Your alternative method definitely sounds worth a try, and it’s more direct than a listbox separate from the original field, so it’s the way I’d really prefer it anyway. I’ll try it next time I’m in that form!! Thank you.

The form wizard (“Use wizard to create form…”) never creates any listbox. The wizard that is triggered when you are going to draw one does not really help.

Just create some 2-column queries (visible field and primary key) for the referenced items and create working listboxes within a few seconds.
[Example] Relations reflected by list boxes in forms

Thank you. I’m now slowly getting stuff working. Sounds like Base wizards are to be ignored.

The report wizard works quite well with satisfying results that are worth to be refined.