Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Dropdown boxes showing foreign keys in browse windows

Locked
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Dropdown boxes showing foreign keys in browse windows

Unread post by mobilemcclintic »

Hello,
I have 5 tables.
My main table is Ticker with fields for author(txt), ticker(txt), department(dropdown), priority(dropdown) and status(dropdown)
I have tables for department, priority, and status that each have their records for the available choices.
On the edit form for Ticker, I can see the values that were chosen, but on the browse table, I see the goggligook letters for the foreign key id that is sitting in Ticker instead of the values in the related table.
Is there an easy way to configure this so I see what I want on the browse screen?
I saw an example in a tutorial, but it was pulling data from a "hardcoded" list (1|Hello, 2|Goodbye)

I thought it would be SELECT department from table_department where department_id = #department_id# or something similiar in the little display box on the browse tab for the form, and tried a few different things, but can't figure it out.

Thanks to everybody who reads this and possibly helps me out.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Dropdown boxes showing foreign keys in browse windows

Unread post by admin »

mobilemcclintic,

Try this..

Code: Select all

SELECT theid, thedescription FROM thetable
The first column is what gets stored, the second is what you see..

Steven
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Re: Dropdown boxes showing foreign keys in browse windows

Unread post by mobilemcclintic »

Maybe I am not explaining my issue correctly, it has been a long day.
I have
Table: Ticker
Field(PK): ticker_id
Field: tic_priority

Table: Priority
Field(PK): priority_id
Field: pri_priority

I created form priority, and added some records (Faster than Superman, Roundfile, etc)
I created form ticker, and used dropdown for tic_priority.
In the dropdown tab I used "select priority_id, pri_priority from priority"

After saving the form, I open the Edit form and can add text (there are other unnoted fields but they are straight text fields) and select Roundfile as a priority.
If I go to the browse form, I see my text fields, and then for priority I see 562a7755a7ae0dd

I entered the query representing your reply above into the browse/display box and received an error, so I'm hoping I"m just putting it in the wrong spot. If I go to the field's browse tab, it has different options.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Dropdown boxes showing foreign keys in browse windows

Unread post by admin »

mobilemcclintic,

In the SQL of the form you will need to join both tables and in the Browse Subform use the descriptive column you want to see.

I hope this answers things..

Steven
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Re: Dropdown boxes showing foreign keys in browse windows

Unread post by mobilemcclintic »

That worked perfectly, thank you.
Until you said it, I was afraid changing the SQL of the form itself would mess up the edit form, but since all the fields are there, I see now that it won't.

Thanks again.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Dropdown boxes showing foreign keys in browse windows

Unread post by admin »

.
Locked