Cannot addFoundSetFilterParam to related foundset

I would like to add a Filter to a related foundset.

var _fsTenantUser = tenantuser$sec_user_id
_fsTenantUser.addFoundSetFilterParam('oidtenant', '=', _oidtenant)				
_fsTenantUser.loadAllRecords()

But I get the following error in the Console:
“Cannot addFoundSetFilterParam to related foundset”

Any suggestion how I could do that?
I know, one way would be:

var _fsTenantUser = databaseManager.getFoundSet(‘myDB’, 'tenantuser)
_fsTenantUser.addFoundSetFilterParam('oiduser', '=', _sec_user_id)
_fsTenantUser.addFoundSetFilterParam('oidtenant', '=', _oidtenant)
_fsTenantUser.loadAllRecords()

Bud I rather use my relation, or is this not possible?

ttmgybta,

Try foundset.unrelate().

It creates a copy of the related foundset, the foundset query is the same but it is no longer a related foundset.

Rob

rgansevles:
ttmgybta,

Try foundset.unrelate().

It creates a copy of the related foundset, the foundset query is the same but it is no longer a related foundset.

Rob

That does not work - the moment you add the filter to the un-related foundset and call foundset.loadAllRecords() to apply the filter, the original filter from the relation is removed and only the explicitly set filter is applied.

You cannot add a tablefilter on a related foundset but you can use find/search on the related foundset where the relation will stay intact.

The nice thing is that you can find/search on the main foundset like this:

// Find customers with one or more orders containing one or more products supplied by a vendor in USA
if(foundset.find()){
    customers_to_orders.orders_to_order_details.order_details_to_products.products_to_suppliers.country = 'USA';
    foundset.search();
}

or through the related foundset like this:

// Find orders of THE SELECTED CUSTOMER that were shipped to Argentina
if(customers_to_orders.find()){
    customers_to_orders.shipcountry = 'Argentina';
    customers_to_orders.search();
}