rbf_setLookupFilter

Posted by Rollbase User on 25-Apr-2013 14:13

How to use "rbf_setLookupFilter", instead of main-link-lookup. I have a page with two lookupfields "customer" and "contact". I want to filter "contacts" with the value of "customer". Something like this: " var cust=rbf_getFieldValue("customer"); rbf_setLookupFilter('contact', 'customer', cust); " But when should this script be processd: OnChange(Customer) or OnChange(Contact) or ? or ?. And how can I delete this filter? Can I use rbf_setLookupFilter in GridControls?

All Replies

Posted by Admin on 02-May-2013 11:14
Yes, you can do something like this (tested in my environment):



var x = rbf_getFieldValue("R893531");

rbf_setLookupFilter("R893508", "R893517", x);



Execute this script on change of lookup value. To clear filter - use empty values.



Please note that all relationships names are different, so make sure you're using correct ones. This probably will not work in Grid.



However it may be much easier if you edit your Contact lookup field and set "Main lookup" and "Link lookup". This feature was designed for the cases like yours.
Posted by Admin on 10-May-2013 05:12
Is it possible to filter using date-fields?

* If yes, can you give me an example (date-format etc)



is it possible to have many filters attached?



Is it only possible to set one filtervalue?

or

Can we also set filtervalue as for example "from-to"?
Posted by Admin on 19-Jun-2013 21:14
Can you please answer this question:



* Is it possible to filter on field on multiple values?



If I try to set multiple filters on one field it seems like the second filter, clears the first filter.



It have been great to have the possibility to set a filter with a sql-query!!

Posted by pvorobie on 17-Mar-2015 11:51

rbf_setLookupFilter(fieldname, filterName, filterValue)

This function sets filter to selection of related records for lookup field. Method can be used for dynamic filtering of available lookup choices. Parameters:

• fieldName: integration name of lookup field

• filterName: name of field on related object used for filtering

• filterValue: only records with field's value equal to filterValue will be displayed

Example:

rbf_setLookupFilter('R12345', 'club_menber', 'true');

This call will ensure that selector window (opening on R12345 lookup field) only displays records with value of club_menber field equals to 'true'.

Important: This function cannot be used on dependent lookups. This function only apply for "Selector" style lookup fields.

This thread is closed