2

I have two tables set up in a 1 to N relationship with the field "UE". Table 1 is a parent. 'Table 2' is a child.

I want to filter all entities in table2 that don't have a corresponding entity in 'Table 1'.

How do I do that?

1 Answer 1

1

Using Expression Selection and the following expression:

aggregate (
    layer:= 'table1',
    aggregate:= 'count',
    expression:= $id,
    filter:= "UE" = attribute (@parent,'UE'))> 0

the selection must be made starting from the child layer and select all the records that have a parent, then invert the selection to find the orphaned records.

OR

to select orphaned records directly, use NOT in front of the above expression:

NOT aggregate (
    layer:= 'table1',
    aggregate:= 'count',
    expression:= $id,
    filter:= "UE" = attribute (@parent,'UE'))> 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.