This topic is locked

Lookup field overwrites current field data

7/26/2013 2:57:15 PM
PHPRunner General questions
B
bussb author

I am trying to solve a issue of sorts. I have a form field called "Employee Name" which is a lookup field from the user table filtered by all users with status=Active. So today, lets just say for example that the active employee look-up choices are:
Bob

Mary

Sue

Joseph
Record #1003 is created, someone selects "Bob" and saves the record. No problem.
Now, Bob leaves the company so his user record is set to status=Inactive. Bob no longer shows up as an option in the look-up drop down menu.
BUT....here is the problem.
If I go back and Edit record #1003, the Employee Name field value will get overwritten with a Null value or the default selection since "Bob" is no longer a choice in the look-up menu.
How do you other designers deal with this situation? I don't want a drop down list of employees to always include people that no longer work at the company, but that is the only way currently that keeps the data from being overwritten.
This is the same with any look-up field, assuming the options change with time.

N
nohope4you 7/30/2013

You could store the value of the Employee Name field into a session variable on the before page displayed event area, and in the before record updated event area have it use the session variable if employee name is blank or null
If you wanted to go even further with it, I would hide that field and have another field for changing instead of using the original Employee Name field, so on a change, it updates as I described above. You could even have the lookup be related to another field that has the dropdown of show all and show only active, that would allow a user to change an inactive persons name without having to change their status.



I am trying to solve a issue of sorts. I have a form field called "Employee Name" which is a lookup field from the user table filtered by all users with status=Active. So today, lets just say for example that the active employee look-up choices are:
Bob

Mary

Sue

Joseph
Record #1003 is created, someone selects "Bob" and saves the record. No problem.
Now, Bob leaves the company so his user record is set to status=Inactive. Bob no longer shows up as an option in the look-up drop down menu.
BUT....here is the problem.
If I go back and Edit record #1003, the Employee Name field value will get overwritten with a Null value or the default selection since "Bob" is no longer a choice in the look-up menu.
How do you other designers deal with this situation? I don't want a drop down list of employees to always include people that no longer work at the company, but that is the only way currently that keeps the data from being overwritten.
This is the same with any look-up field, assuming the options change with time.