V3.6.1
What is the best way to move a field from an extended class into its parent?
I have a base class that extends DataObject called Person that contains common information such as name, email etc. I then have 3 classes that extend Person, called Staff, Visitors and Contractors that contain fields specific to that type of person.
Currently, Staff and Contractors have a location field used to store their base location, which is stored in the Staff and Contractor classes.
The client now wants to add a location to the Visitor class as well and to retrieve a single filtered list of all people (Staff, Contractors and Visitors) that are at a specific location. This gives me two options, both of which are flawed:
-
I add Location to the Visitor class - However, this is then both untidy as common information is stored in all of the extended classes, plus it doesn’t allow me to filter a single list of all Person records at a particular location.
-
I add Location to the Person class and remove it from the Staff and Contractor classes - However, this then loses all of the existing locations stored for the Staff and Contractors.
My question is, what is the best solution and does anyone know of a way that I can either:
-
Select all records from the parent class filtering on the location field in the Extended class?
-
Move the location field from the extended classes to the parent class without losing existing data?
Thoughts, more than welcome!