Select statement using 2 different columns

I have 3 linked table;
Doc (has document details) which has a ref to
Doc_type (for example letter or plot plan) and both these tables have a ref to
Doc_type_group (in example of letter, correspondence and of plot plan, drawing).

In the Doc table, the user first selects the Doc_type_group and then I have used this Valid_if statement on the Doc_type column which works like a treat to show only the related Doc_types.

orderby(select(doc_type[doc_type],[doc_group]=[doc_type_group],false),[doc_type])

So my next step is to have the user select only certain Doc_types that he will use on this particular project (i.e. in this app). I have added a column called Used into Doc_type as a yes/no. I don’t want to delete all the other Doc_types as he may need them in the future, I just want them not to show.

How do I add ‘another’ Select statement to exclude Used=no? My current select statement uses column doc_type (the key) but this wold have to select based on column Used.

Hi @Riki_Armstrong Check out AND()

Thank you. I had tried the AND but it kept not finding anything using where [used]=yes so I thought something must be wrong with my expression. This worked:

orderby(select(doc_type[doc_type],and([doc_group]=[doc_type_group],[used]=y),false),[doc_type])

Although the data in my table is written as yes and no and the column type is a yes/no, the yes has to be type as y in this sort of expression.

In case anyone else runs into this problem in the future. :blush:

“True” and “False” might work also.