Hello community
I’m working on a custom app so in my form I have a linked field gets its list from a doctyp has one data field, and another field gets it’s list from other doctype has two fields a data field and a linked field to the first doc I mentioned I want in the third form to link poth docs and filter the second one based on the value chosen by the first one.
Let’s assume that a doctype called Case has values case1, case2 …
Another doctype called Test has values test1, test2 within value of case1 and test3, test4 within value case2 in the third form I want to link both doctypes so when I chose case1 so will filter the linked field with test1 and test2
Maybe it will be easier to understand with “real use case” …
Let’s say you have myCustomer (with customer data), myState (with states of a country) and myCity (with cities linked to states)
When you add a new customer, you want to select a city based on the state .
So, if you select Louisiana as State, City will be filtered with state and only cities that belongs to Louisiana will be shown… right?
Finally, create MyCustomer …
Three fields, Customer as Data, State as link to MyState and City, link to MyCity and set filters [["MyCity","state","=","eval: doc.state"]]
Just to elaborate on @avc ‘s answer to make it crystal clear:
It is an array of filters so that you can filter on multiple fields of the target DocType
Entry 1: is the DocType Name that you are filtering (should match the ‘Options’ of the link field you are applying the filter to, for example Customer)
Entry 2: is the fieldname of the column you are filtering on that DocType
Entry 3: is the operator, one of =, <, >, <=, >=, “is”, “is not”, “like”, “in”, “not in” should work
Entry 4: is some javascript to run to obtain the value to filter against. doc is the current document record data to use in the filter