How to use Calculate Value for if then?

771
4
05-07-2020 01:17 PM
WhitneyWeber
Occasional Contributor

I have looked through the documentation for using Calculate Value to act as if then in Model Builder, but am not connecting the dots. I want to Get Count to determine the number of rows. And then use that with Calculate Value to return TRUE else FALSE. So, if Row Count>0, then TRUE, else FALSE. Then use a While to point to the appropriate next steps. But how do I connect the Row Count to the Calculate Value? Obviously I'm missing a step or have made this too complicated because this is not feasible as described.

Please advise!

Tags (1)
0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

I don't use model builder but I had a quick look. Something along the lines of (guessing the model builder syntax):

myfunc(%Row Count%)

def myfunc(input):

    return bool(input)    

0 Kudos
FC_Basson
MVP Regular Contributor

Your row count can be done like this in Modelbuilder

with you Calculate Value expression like this

WhitneyWeber
Occasional Contributor

I apologize for not replying sooner - that was very helpful and worked, but I required additional complexity which forced me to Python. I needed to take the leap regardless. Thank you for your response and help!

0 Kudos