I am trying to use the Relations Conditions field with a model related to the primary model. However, I can't seem to get it to work. The primary model is called Content. The related model is called Traits. I am trying to call all Traits that have a content_id field = to each Content id, and that have a category_id = to a variable I will be pulling from another model using $this->get('other_model...') (but for now I am just using a single number to figure out the correct syntax).
I put this in the Relations Conditions field:
Traits.content_id:Content.id
Traits.category_id:19
But I am just getting an unknown column error. I have attached an image of the read data form as well.
Any help is appreciated!
Thanks -
-Brian
I put this in the Relations Conditions field:
Traits.content_id:Content.id
Traits.category_id:19
But I am just getting an unknown column error. I have attached an image of the read data form as well.
Any help is appreciated!
Thanks -
-Brian
Hi Brian,
What error do you get ? and does it work with the first rule only ?
Best regards,
Max
What error do you get ? and does it work with the first rule only ?
Best regards,
Max
I tried just with the first rule only and got this error:
Unknown column '' in 'where clause' SQL=SELECT `Traits`.`content_id` AS `Traits.content_id`, `Traits`.`id` AS `Traits.id`, `Traits`.`category_id` AS `Traits.category_id`, `Traits`.`text` AS `Traits.text` FROM `#__traits` AS `Traits` WHERE ``.`` IN ('85', '86', '87', '88', '89', '90', '91', '96', '102', '103', '104');
I tried with both rules and got the same error.
I should note that I am also using the Fields to retrieve field to limit the return. The code I am using is below for reference. However, even when I delete all of this, I still get the above error.
Code in Fields to Retrieve:
Unknown column '' in 'where clause' SQL=SELECT `Traits`.`content_id` AS `Traits.content_id`, `Traits`.`id` AS `Traits.id`, `Traits`.`category_id` AS `Traits.category_id`, `Traits`.`text` AS `Traits.text` FROM `#__traits` AS `Traits` WHERE ``.`` IN ('85', '86', '87', '88', '89', '90', '91', '96', '102', '103', '104');
I tried with both rules and got the same error.
I should note that I am also using the Fields to retrieve field to limit the return. The code I am using is below for reference. However, even when I delete all of this, I still get the above error.
Code in Fields to Retrieve:
<?php
$return = ["Traits.content_id", "Traits.id", "Traits.category_id","Traits.text"];
return $return;
?>
Hi Brian,
For "Multiple records" you should set the "Foreign key", in this case its "Traits.content_id", using the relations conditions will cause an error, but I have added a fix to this and the new update should apply the "Relation conditions" as Where conditions for the Multiple records relations.
Let me know if you need the patch file before the new release, the new update is expected to be available by Monday.
Best regards,
Max
For "Multiple records" you should set the "Foreign key", in this case its "Traits.content_id", using the relations conditions will cause an error, but I have added a fix to this and the new update should apply the "Relation conditions" as Where conditions for the Multiple records relations.
Let me know if you need the patch file before the new release, the new update is expected to be available by Monday.
Best regards,
Max
If I could get the patch file, that would be great. I have a deadline I am working on and was hoping to get most of the remaining work done over the weekend.
Thanks -
-Brian
Thanks -
-Brian
Hi Brian,
Please send me a message using the "Contact us" page.
Best regards,
Max
Please send me a message using the "Contact us" page.
Best regards,
Max
This topic is locked and no more replies can be posted.