This topic is locked

Lookup field without field saving

6/14/2018 9:08:16 AM
PHPRunner General questions
S
sol author

I am wondering, if there is a solution for the following lookup issue without programming.
I have a main table "marina", assigning a city (FKcity) to the marina. The city is assigned to a country.


Listing the marinas, I join the tables "marina", "city" and "country".


Now comes the problem. When adding or editing a marina, I would like to be able to select the country first, in order to only have the cities of this country to choose for assigning to the marina.

But if I also use the country-field of the original query, PHPrunner says, that it can't save this field. Of course, as this field is not part of the "marina"-table.
This is how I would like to look the form like:


This way, it works fine, but I have no country-field to preselect the cities.


I am aware that having a "FKcountry"-field in the "marina"-table would help. But this would not be nice in terms of normalization. I hope, there is a way to realize this without programming...

Thanks for your help to a newbie in PHPrunner with no PHP programming knowhow (coming from Access-VBA-World).

Oliver

admin 6/15/2018

When you save your record make sure you are not trying to save fields from joined tables. For this purpose in events BeforeAdd and BeforeEdit remove fields from joined tables i.e.

unset($values["country"]);


More info:

https://xlinesoft.com/phprunner/docs/update_multiple_tables.htm