Display Name, but use ID

Creating and using forms
Post Reply
diginix
Posts: 2
Joined: Sun Oct 07, 2018 11:09 am

Display Name, but use ID

Post by diginix »

Hello,
I am new to this forum and to OpenOffice.
Sorry, I haven't found easy solution for my question, maybe not good in search ))

Here is my question:
I have 2 very simple tables.

Table "Operation"
ID, Name, ProjectID (it's for relationship with ID of second table)

Table "Project"
ID, ProjectName

In Operation form I am creating Listbox for ProjectID with data collected from "Project" Table ("ProjectName")

In the dropdown list I see Project Names. But after I choose the right name, I see just ProjectID.
I want the form to show ProjectName.

Could someone help, please?
Thanks.
MacOS X 10.13.6
OpenOffice 4.1.5
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Display Name, but use ID

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
UnklDonald418
Volunteer
Posts: 1547
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Display Name, but use ID

Post by UnklDonald418 »

A list box control on a Base form uses two fields, a display field and a boundfield.
The display field must appear first and the boundfield must appear second.
For instance, open the Properties: List Box dialog for your list box and on the Data tab
the Data field would be "ProjectID" from the table "Operation".
Input required should be Yes
Set Type of list contents to Sql
the List content to

Code: Select all

SELECT   "ProjectName", "ID"  FROM "Project" ORDER BY  "ProjectName" ASC;
and leave the Boundfield set to 1 (changing it to anything else is futile)
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
diginix
Posts: 2
Joined: Sun Oct 07, 2018 11:09 am

Re: Display Name, but use ID

Post by diginix »

Thanks,
Yes it's working fine with Listbox without Editing or find possibility
But when it can be entered manually it doesn't work correctly.
Sorry, I am using not English version of Open Office, so it's possible to make some misunderstandings with UI element names ))
MacOS X 10.13.6
OpenOffice 4.1.5
UnklDonald418
Volunteer
Posts: 1547
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Display Name, but use ID

Post by UnklDonald418 »

I'm not sure what you mean when you say
But when it can be entered manually it doesn't work correctly.
If you are trying to add new entries into the "Project" table, that is not possible using a list box.
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
Post Reply