5

I have a question regarding using the Conditional Branch algorithm in the Graphical Model Builder.

I am building a rather complicated model with many branches but not every branch needs to be used every time. So I want to use the Conditional Branch algorithm to check the "art" column of the attribute table from my input layer and to only run that branch if a given value is present, PX or QX in this particular case.

The model will have at least 15 branches when I am finished but usually only a few will be needed per job.

So, I need to use the Conditional Branch algorithm as a kind of if/else filter where if the value is present it runs the branch elsewise it ignores that branch and moves on to the next one.

How do I set up the Conditional Branch so that it ignores that branch unless the value is present?

(Pic isn't my main model, just an example)

basic model

1 Answer 1

6

I've created a model with an input point layer.

A conditional branch with two conditions:

  1. If there is an A in the art column: The points get buffered
  2. If not it will create rectangles around the points.

Start by renaming the layer to inlayer

Create a conditional branch with the condition aggregate(layer:='inlayer', aggregate:='count', expression:="art", filter:="art" IN('A'))>0

(IN Operator)

It will count the number of values in the art column where the value is A. If more than 0 the branch will be True.

Create another branch with the opposite condition: aggregate(layer:='inlayer', aggregate:='count', expression:="art", filter:="art" IN('A'))<1

enter image description here

Use the branches as dependecies to the next algorithms: enter image description here

enter image description here

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.