⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

filter from one to many relation table



redhen_07
  • profile picture
  • Member

Posted 22 July 2013 - 13:18 PM

i have a question on that 2 tables faculty_list and clearance table

 

 this is the flow of my program:

1. on my clearance table i add faculty fname,lname,campus,school,department (from related facultylist table) who are submitted their clearance - (this is solved using relation from my clearance table to faculty_list table).

 -  meaning the one encoded on clearance table is the faculty who have submitted.

 

* now my question is how can i filter from faculty_list table that who ARE NOT yet submitted their clearance.

 

my table:

faculty

        id

        fname

        lname

        campus

        school

        department

 

clearance

        id

        faculty_id (related to faculty table id)

        campus_id (related to faculty_list campus)

       school_id(related to faculty_list school)

       department_id (related to faculty_list department)

        clearance

        year

 

 

 note: my only option now is import all related fields from faculty_list table (id, campus, school, department) to my          clearance  table,  then fill out cleance and year if the faculty submit their clearance. the data column not yet fillout meaning the one who are not submitted.. but i hope their is another option not to import..


davidoster
  • profile picture
  • Member

Posted 23 July 2013 - 02:14 AM

Can you add on the faculty table a clearance_status field that relates to the clearance.clearance?

And then just use the where function to show only the ones you want?


redhen_07
  • profile picture
  • Member

Posted 23 July 2013 - 11:13 AM

thank you for the idea sir david...

 

but my clearance is for many. i mean faculty_ist with many clearance.. beacuse on my case is yearly they need to submit clearance..

 

and when i add clearance_status on my faculty table every time i add clearance on clearance table i need also to add clearance_status on my faculty table..

 

maybe i think my last option is to import all related table from facult to clearance.. every year i need to import.lol.. and filter by year


ceroberoz
  • profile picture
  • Member

Posted 27 July 2013 - 18:45 PM

something like this?

you can change the PENDING into whatever status on your clearance values

$this->grocery_crud->set_relation('id','faculty','id',array('clearance' => 'PENDING'));

source