Hide null value from lookup field

Hello @mnikitina,

I have a small question. Can you please tell me how to hide null values from a lookup field?

image

Thank you !!!

Hello @Vasilii_Burca,

You can set up lookup values filtration like this:

fd.field('Lookup').ready().then(function() {
    fd.field('Lookup').filter = 'Title ne null';
    fd.field('Lookup').refresh();
});

How can I use this filtration?

Hello @pantea_gooshe,

You need to add this code to JavaScript editor in the desktop designer:
image

Don't forget to replace Lookup with the internal name of the lookup field and add the code under spRendered event like this:

fd.spRendered(function(vue) {
   fd.field('Lookup').ready().then(function() {
       fd.field('Lookup').filter = 'Title ne null';
       fd.field('Lookup').refresh();
   });
});

Hi Mnikitina,

I have used this code and it doesn't do anything. I have tried using it with/without the Vue parameter and still nothing happens.

Here is how I have the code down in the editor:

fd.spRendered(function() {
   fd.field('Non_Voluntary').ready().then(function() {
       fd.field('Non_Voluntary').filter = 'null';
       fd.field('Non_Voluntary).refresh();
   });
});

Hello @DryChips,

If you want to hide empty values you need to define the filter: 'Title ne null'.

Update the code and test.

Hi,

It comes back undefined in the console.

image

Hello @DryChips,

You need to replace Title with the internal name of the lookup field target column:
image

1 Like

Perfect! Thank you for the clarification :blush:

1 Like