AnsweredAssumed Answered

How do I create a field in the list view to search by grandparent relationships?

Question asked by gperez gperez on Feb 20, 2014
Latest reply on Feb 26, 2014 by gperez gperez
I'm trying to add a search field in a list. However that search field doesn't refer to a module defined in Admin->Studio->[Module]->Relationships because the modules are not sirectly related. I understand this is a "grandparent" relation. Let's say A -> related to B -> related to C. So, from A I need to access to a C field.

I searched a lot about it and I'm trying to setup my code in the right way. I assume that relationships are already functional (since they were made in Studio). So only thing I should do is adding the field to $dictionary array, in /custom/Extension/modules/[A module]/Ext/Vardefs/myCustomField.php

So, I'm trying this: 

$dictionary['oas_third_party_payment']['fields']['name'] = array (
    'name' => 'name',     // column name
    'id_name' => 'id',
    'type' => 'relate',
    'rname' => 'name',    // column real name
    'vname' => 'LBL_PROPERTY_NAME_OAS_THIRD_PARTY_PAYMENT', // Human name label
// 'relationship' => 'oasis_reservations_oasis_properties',
    'link' => 'oasis_reservations_oasis_properties', // oasis_properties_oasis_reservations
    'module' => 'oasis_Properties',
    'source' => 'non-db',
    'dbType' => 'non-db',
    'studio' => 'visible'

This results in a search filter and that's good. However, the resulting query is not being well constructed because:
1) it lacks of the JOIN from B to C
2) it says where (( like '%Penthouse Leblon%'))
Where "o" refers to nothing at all. That should be the name of C table (in this case, 'oasis_Properties')

What am I doing wrong? What I am missing? And please, explain me what does the "key" names represents here, because there's very little info about it. (here and here)