This topic is locked

Lookup question

10/29/2010 7:31:39 AM
PHPRunner General questions
G
gtjeerdsma author

I do have for this problem 4 simplified tables.
Table1: cars - Fields: carId, carname, country
1 - BMW - Germany

2 - Fiat - Italy
Table2: colours - Fields: colourId(INT), colourcode(VARCHAR), colourname(VARCHAR)
1 - red1 - light red

2 - red2 - dark red

3 - blu1 - light blue
Table3: carcolours - Fields: carcolourId(INT), carId, colourId
1 - 1 - 1

2 - 1 - 3

3 - 2 - 2

4 - 2 - 3
Table4: MyCars - Fields: MyCarId, carId, colourid
Add/Edit MyCars

Lookup table : cars, link field: carId, display field: carname

so far so good
My questions or better my problem:

How do I solve the problem to display through lookup the field colourname in colourId.
I do need table 3. if i combine table 2 and 3 more then 300.000 records will be needed.
If possible a second question.

adding a field colourcode to table MyCars

after selecting in the lookup and displaying the colourname (problem 1)

is it possible to fill the new field with the colourcode from table colours (read only)
thank for any help in advance
Geert Tjeerdsma (NL)

A
ann 11/4/2010

Hi,
please see my comments:

  1. unfortunately the only way is to join Tables 2,3.

    Create a View directly in the database joining the tables and then use it as a lookup table in the Edit as settings dialog on the Visual Editor tab.

    Here is a helpful link:

    http://dev.mysql.com/doc/refman/5.0/en/create-view.html
  2. I'm not sure that I fully understand your question.

    Could you clarify what field do you want to fill with the 'colorcode' field value.

    Maybe a screenshot or two can help.