Non-Cascade Lookup Filtering

Hello again

You have examples of cascading lookup.
But I just need a simple filter of a company field, so that it only show companies if the column within company list (Status_x0020__x0028_TXT_x0029_) does not have a value of “Inactive”. I just can’t seem to get this filter working!

Here is my code, I am sure I am making a silly mistake, but it is just a bit different from the cross site lookups I am used to writing :slight_smile:

//Filter Company Function
function filterCompany(){
fd.control(‘Company’).filter = ‘Status_x0020__x0028_TXT_x0029_ neq Inactive’;
fd.field(‘Company’).widget.dataSource.read();
}

fd.spRendered(function() {
//Always hide stuff
$(’.AlwaysHide’).hide();
//Filter Company so no inactive companies show
filterCompany();
});

Thanking you in advance!

Hello Jamal!

Please use the below code. Just check that the fields’ internal names in the code match the actual ones.
And please add the field that you want to use for filtering and ordering in Extra Fields under Lookup field Settings.

image

fd.spRendered(function() {
fd.field('Company').filter = "Status_x0020__x0028_TXT_x0029_ ne 'Inactive'";
fd.field('Company').widget.dataSource.read();	
});
1 Like

Thank you!

You are a :star:
:slight_smile:

1 Like