[Solved] List Control within TableControl

Creating and using forms

[Solved] List Control within TableControl

Postby nathan3553 » Wed Dec 14, 2016 6:38 pm

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 96 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
nathan3553
 
Posts: 17
Joined: Sat Oct 18, 2014 6:35 pm

Re: List Control within TableControl

Postby Villeroy » Wed Dec 14, 2016 7:58 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28573
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

[SOLVED] Re: List Control within TableControl

Postby nathan3553 » Wed Dec 14, 2016 8:14 pm

Perfect - Thanks!
OpenOffice 4 on Windows 7/OpenOffice 4 on MacOSX
nathan3553
 
Posts: 17
Joined: Sat Oct 18, 2014 6:35 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 4 guests