⚠ 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

Where at set_relation_n_n not working



domibln
  • profile picture
  • Member

Posted 19 February 2019 - 10:40 AM

Hi guys,

 

I have the following problem. I have two main tables ('Produkte' and 'Systeme') and one junction table for the n-n relation ('Produkte_Systeme'). I need to add the information about Systeme to the Produkte table - this works without problem using the below code:

$crud->set_table('Produkte');
...
crud->set_relation_n_n('Systeme', 'Produkte_Systeme', 'Systeme', 'Produkt_ID', 'System_ID', 'Bezeichnung');

But now I want to use a filter on System_ID to show only products for a certain system. I tried to use the following code according to the forum post here to get only products which are related to system with ID 3:

$crud->set_relation_n_n('Systeme', 'Produkte_Systeme', 'Systeme', 'Produkt_ID', 'System_ID', 'Bezeichnung', null, array('ID'=>3));

But the filter does not apply to the table view, only to the available options on the add/edit forms (in case of the example it limits the available systems from 1 to 3.

 

How can I add the where clause to the entire table / view?

 

I would appreciate any help. Thanks!


noplan
  • profile picture
  • Member

Posted 17 March 2019 - 21:53 PM

Hi  domibln

 

I'm, struggling with the same issue but for a simple set_relation (/topic/136722-set-relation-with-where-parameter/

). Poor us :(