This topic is locked
[SOLVED]

Lookup from mysql table wrong record selected and autofill error

8/16/2022 4:30:08 PM
PHPRunner General questions
G
gtothill author

Hi everyone,
I have an issue that I was hoping someone could help me with.

I have a table that contains city data - specifically the name of a city, the country it is in, the ISO code of the country and an auto incrementing key.

Im using this table as a lookup table to populate a city and its associated country into the add page of another table.

So, here is the Lookup selection:

img alt

And this is the autofill selcting the country field from the lookup table.

img alt

When actually doing the lookup (in this case searching for London) these are the records that are returned - note that there are multiple cities around the workd named 'London'

img alt

If I select the London in the United States, the lookup autopopulates the country field - but if there are multiple identical records (ie lots of cites all called London) then the lookup seems to always return the first record. In this case it is the London in Canada. This is unexpected.

img alt

Can anyone shed some light on this for me? II may have made a mistake with key allocation but it seems to me that every row in the lookup table sould be unique.

Thanks in advance,

Geoff.

G
gtothill author 8/16/2022

I see the images were inserted in the wrong order but I hope the gist is clear.
I should also add that this is with PHPRunner 10.8 Build 39712x64 and mySQL 5.7

G
gtothill author 8/16/2022

Sorry to have increased the noise in this forum.
Just to say that I made a simple mistake - I set the wrong link field (see image above).
When I set the link field to country it worked perfectly.
I just know I did the same thing years ago ...........