Skip to main content
Topic: Self-referencing Master/Detail doesn't show Record Display Fields (Read 498 times) previous topic - next topic

Self-referencing Master/Detail doesn't show Record Display Fields

I am using PHPRad Classic version 2.7.3. I have a self-referencing table (Staff) that doesn't show any of the Staff fields in the Record Display Field select list on the Master Detail Relation dialog. In this case, staff.manager_Staff_staffId in the Staff table references staffId in the same table. My expectation is to be able to pick from the fields that are in the Staff table.

Note that the Record Display Field shows the detail fields just fine on non-self-referencing tables.

I tried to upload a picture but got "The upload directory is full. Please contact an administrator about this problem."

Any assistance would be most appreciated.

Thanks for the great product.


Re: Self-referencing Master/Detail doesn't show Record Display Fields

Reply #1
@wescleveland‍ that is because phprad does not support self-referencing, if you are goig to do that you will have to use the corrent record value as you cannot select any other field from the master details relation configuration.

Re: Self-referencing Master/Detail doesn't show Record Display Fields

Reply #2
Thanks for the reply Willvin. I must admit that I am surprised that phpRad doesn't support self-referencing relationships. This is a common database design technique. I'm not sure what you mean by "use the current record value". The data in the current record is not the data for the referenced record. Here's an example:

I have 2 records in my Staff table:

Record 1:
  • Id: 1
  • Name: Person 1
  • Manager Id: Null

Record 2:
  • Id: 2
  • Name: Person 2
  • Manager Id: 1

When displaying Record 2, then name of the Manager should be "Person 1" but the name on the current record is "Person 2". "Person 2" would not be the correct value.

For those interested, I did find a workaround by creating a view that selects the Id and Name from the Staff table and then referencing the view for the lookup instead of the directly referencing the table.

Thanks again for the quick reply.