How to set up Lookup filtering


When I select for example a tool group, I only want to select the tools that belong to that group in the next field. Does that sound great? Well, let’s find out how to achieve it.

The result

Let‘s create 3 tables:

  1. Table Tools with important fields:
    Name – text data type with name of the tools
    Tool Group – data type Link to table - Tools Group – show field in linked table

  2. Table Tools Group with important field:
    Name – text data type with name of the tools group

  3. Table Orders (where I need to use Lookup filtering) with important fields:
    Tool Group – Link to table -Tools Group
    Tool name – Link to table - Tools

    You can create as many fields in the tables as you need, I mentioned only the important ones.

Go to the Orders table settings, select the „Scripting“ area, pick „On the model change“ section and use JS bellow:
Table settings


if (doo.model.<[Tool Group (toolGroup)]>.value?.id) 
doo.model.<[Tool name (toolName)]>.filterForDropdown = ' === ' + doo.model.<[Tool Group (toolGroup)]>; 
  doo.model.<[Tool name (toolName)]>.filterForDropdown = null;  

That’s how easy it is! We already know the principle, so now you just have to redo the solution according to your application.:blush:

Thank you for reading.

With kind regards,