Display Name, but use ID

Creating and using forms

Display Name, but use ID

Postby diginix » Sun Oct 07, 2018 11:15 am

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
diginix
 
Posts: 2
Joined: Sun Oct 07, 2018 11:09 am

Re: Display Name, but use ID

Postby Villeroy » Sun Oct 07, 2018 5:20 pm

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26562
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Display Name, but use ID

Postby UnklDonald418 » Sun Oct 07, 2018 5:35 pm

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   Expand viewCollapse view
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.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1086
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Display Name, but use ID

Postby diginix » Sun Oct 07, 2018 8:37 pm

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
diginix
 
Posts: 2
Joined: Sun Oct 07, 2018 11:09 am

Re: Display Name, but use ID

Postby UnklDonald418 » Sun Oct 07, 2018 10:16 pm

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.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1086
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to Forms

Who is online

Users browsing this forum: No registered users and 1 guest