[Solved] List Control within TableControl

Creating and using forms
Post Reply
nathan3553
Posts: 17
Joined: Sat Oct 18, 2014 6:35 pm

[Solved] List Control within TableControl

Post by nathan3553 »

Hi everyone - I'm hoping to get the form setup so that user can select via a drop down the values of Fund table instead of the ID.
This form is used for data entry, so ideally the user would select the fund value and it inserts the fund ID into the contribution table.

I'm having trouble getting the list control to display the values.

FORM: FAMILY2_NEW
Attachments
Contribution (9).odb
samplefile
(22.87 KiB) Downloaded 186 times
Last edited by nathan3553 on Wed Dec 14, 2016 8:28 pm, edited 1 time in total.
OpenOffice 4 on Windows 7/OpenOffice 4 on MacOSX
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: List Control within TableControl

Post by Villeroy »

Data Field: FUND_ID [the field where you want to write a number into]
Type: SQL [works with any order of fields]
Content: SELECT "FUND", "ID" FROM "FUND" ORDER BY "FUND" ASC [a visible text and the one with the numbers to be written ordered by the visible text]
Bound field: 1 [0 is the index of the visible, 1 is the index of the number]

alternatively:
Type: Query
Content: name of a query with the same SQL as above
this is perfectly equivalent but saves a little bit of work when you have many of the same list box.

In rare cases where the visible value is the same as the value to be written:
SELECT "FUND", "FUND" FROM "FUND" ORDER BY "FUND" ASC [select the same field twice]

In cases where you want to have many visible fields you concatenate fields and separators like this:
SELECT "Surname" || ', ' || "Forename" || ' (' || '"Birthdate" || ')' AS "Visible", "ID" FROM "Persons" ORDER BY "Visible" ASC
gives list box entries like
Doe, John (1988-12-25)
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
nathan3553
Posts: 17
Joined: Sat Oct 18, 2014 6:35 pm

[SOLVED] Re: List Control within TableControl

Post by nathan3553 »

Perfect - Thanks!
OpenOffice 4 on Windows 7/OpenOffice 4 on MacOSX
Post Reply