Welcome, Guest
Username: Password: Remember me

TOPIC: FK not removed from filter

FK not removed from filter 12 Aug 2012 09:21 #3107

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Hi
I had a table called Groups
The foreign key was a lookup to the same Groups and the field was called group_id
An admin Collection layout was created with a filter that used the group_id field

Later i decided that i no longer needed the FK / lookup field group_id

i deleted the FK from the groups table - the object was removed from all layouts as expected

But in the in the admin collection layout the group_id filter remained (was not removed on delete from table)

Symptoms
- when the table had no filtering applied => all records were displayed
- the undeleted group_id filter dropdown listed => all values displayed
- when the user selected the group_id filter value from the dropdown list => no record was displayed (auto submit checked)

Resolution
The FK group_id was removed from the table but not the filter
could not display the selected record because the group_id field was no longer present in the table
deleted the group_id filter

The filter then worked as expected.

Unsure if its a bug or if its just a one off issue where the delete script did not complete but just thought i would let you know...
Last Edit: 12 Aug 2012 09:22 by BTB300.
The administrator has disabled public write access.

Re: FK not removed from filter 12 Aug 2012 09:33 #3108

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes you are right, I know this one.

The broken informations are in the properties only.

The problem came from the fact the properties are stored in a JSON string. And when you remove a FK that has been used as group by property (for example), the group by properties behind to this removed FK are still present. The cascad deletion can not work because of the JSON string which is impossible to search in.

It is a big deal for me.

It do not create a fatal at the building, or in your generated component.
But I know it is really problematic.
This ticket will remain open a while for the moment I don't have any easy solution.

KEEP IN MIND :
Removing the FK can create issues in the properties of objects where this FK has been used.
-> Group by properties of Form > FK
-> Group by properties of Filters > FK
-> Group by properties of Grid
Coding is now a piece of cake
Last Edit: 12 Aug 2012 09:37 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: BTB300
Time to create page: 0.064 seconds

Get Started