This topic is locked
[SOLVED]

 Conditional Look-up source from Two Tabeles

3/9/2015 7:00:04 AM
PHPRunner General questions
G
Getinet author

Hello PHPRUNNER Fans,
Let me see if i could make my request short and get fast response.
In one of my add/edit forms i have a field (sh_code) to be filled up from a lookup table.However it turns out to be

that this field lookup source is not one table but based on custom check box(i created for this purpose) it would be two tables.If a checkbox is ticked a default lookup table should be changed to other table.For this purpose i created alias field on SQL tab sh_code, and sh_code_new so that i will disable one and enable the other by setting up each field to have my desires of having conditional lookup source tables.The problem is that whenever i tried to save record i got error of two fields specified for sh_code, in fact it is expected.
I am in rush of achieving this so people who do done similar design please advice me or direct me to such topic.
Always appreciated this community
Cheer

Sergey Kornilov admin 3/9/2015

I must say this sort of designed is a bit unconventional but if you can get it to work it's the only thing that matters.
I would say that in your BeforeAdd/BeforeEdit event you need to use unset() function for the field that is not currently selected. This would prevent it from getting into the SQL query.
See code examples at http://xlinesoft.com/phprunner/docs/update_multiple_tables.htm

G
Getinet author 3/10/2015



I must say this sort of designed is a bit unconventional but if you can get it to work it's the only thing that matters.
I would say that in your BeforeAdd/BeforeEdit event you need to use unset() function for the field that is not currently selected. This would prevent it from getting into the SQL query.
See code examples at http://xlinesoft.com...iple_tables.htm


Thank you for the replay & support Sergey.I give it a try.

G
Getinet author 3/11/2015



Thank you for the replay & support Sergey.I give it a try.


Hi Sergey, Unset() method works for my purpose,thank you again.