Help with filters

Hello everyone,

I'm working with automatic filters and I have to filter by all the elements contained in sub_element_l_c (sub_element_l_c is a calculated text field with the value of a multi-select field). This is my code from the relate.js:

({
extendsFrom: 'RelateField',
initialize: function(options) {
this._super('initialize', [options]);

if (_.contains(['record', 'create'], this.view.name)) {
var filterDef;


switch (this.name) {
case 'element_template':

var filterDef = {
filter_populate: [],
filter_relate: {

sub_element_l_c: 'sub_element_c',

},

initial_filter: 'filterElements',
initial_filter_label: 'LBL_FILTER_ELEMENTS',

};

break;
}

this.def = _.extend(this.def, filterDef);
}
},

})

The field element_template is a relationship field. 

and this is my code filterElements.php:

<?php


$viewdefs['Elements']['base']['filter']['basic']['filters'][] = array(
'id' => 'filterElements',
'name' => 'LBL_FILTER_ELEMENTS',
'filter_definition' => array(
array(
'sub_element_c' => array(
'$in' =>array(),
)
),
),
'editable' => true,
'is_template' => true,
);

Does anyone know how to filter by all the elements of the sub_element_l_c field? Because what my code currently does is take the first value of sub_element_l_c.

Thank you very much.