6

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

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Dec 1, 2023 at 11:38

1 Answer 1

7

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

answered Dec 1, 2023 at 12:41
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.