Forms LookUp Filtering

Dear Plumsail-Team

I have a question regarding the Filtering Option in the Forms.

So while it is possible to filter the fields Betriebsmittelanweisungen and the rest based on the BAReference-Field on the Betriebsmittel. Is it also possible to do it the other way around.

Now it's only possible to filter if the Betriebsmittel has a reference to one of the other 6 fields. But what if i only have a Reference from the other 6 to the Betriebsmittel ?

The Problem i have with this solution, is that one Betriebsmittelanweisung could have more than one Betriebmittel referenced. But one Betriebsmittel can only have one reference to one of the other 6 items each. So when i select one Betriebsmittel it only shows me one of the other 6 each when instead it should have more listed.

image
this is the Betriebsmittelanweisung-Field and how the filter is configured.

Hello @Dario_Chiga,

You can configure filtration of any complexity using the JavaScript code. Please find the example in our documentation:
https://plumsail.com/docs/forms-sp/designer/sp-fields/lookup/lookup-cascading.html

1 Like

Perfect. Works exactly how i wanted.

Now only thind that i need to do is, that when the BM Reference changes and no value is selected that the filter is removed.

How can i achieve that ?

Nevermind. Found the solution:

function filterProducts(BM) {
   var BMID = BM && BM.LookupId || BM || null;
   if (BMID)
   {
      fd.field('BA_x0020__x002d__x0020_Reference').filter = 'BM_x002d_Reference/Id eq ' + BMID;
      fd.field('BA_x0020__x002d__x0020_Reference').refresh();
   }
   else
   {
      fd.field('BA_x0020__x002d__x0020_Reference').filter = "";
      fd.field('BA_x0020__x002d__x0020_Reference').widget.dataSource.read();
      fd.field('BA_x0020__x002d__x0020_Reference').refresh();
   }
}

Just Check if the Var is empty, undefined, null or whatever and then set the Filter to "" and refresh again.

Found the Solution in Clear a Lookup Filter

1 Like