How to find nodes with a scalar predicate having values found during traversal

This could be a deal breaker for me. I was trying to emulate choose step from gremlin. And this can happen somewhere in the middle of deep traversal.