Select to view content in your preferred language

Model Builder select by inline variable substitution using like %value%

927
1
07-08-2020 08:16 AM
BartłomiejGajc
Emerging Contributor

I am stuck. Have Model Builder selecting features by attributes using text string which is a variable. I need to use LIKE operator (I use 'contains the text' from the drop-down list) but this gives me empty result:

LIKE '%\%rname\%%' ESCAPE '\'

rname is my variable name. I select a feature class form file geodatabase. No error but empty result.

When using the same tool 'manually' it selects what I expect, it gives empty output in model builder. It looks like is does not substitute %rname% with a variable value..

0 Kudos
1 Reply
GarrettMelvin
Occasional Contributor

I have a similar situation and what appears to be incorrect result.  My model iterates field values on feature class A. In the same model I have select by attributes on feature class B.  I used the Calculate Value tool to create an additional variable, that simply adds a 9 to the front of the Value variable.  My expression is
field LIKE %Value% AND field NOT LIKE %Remove% (I have to remove 5 digit values beginning with 9 from the selection from their similar 4 digit values without the leading 9).  When I "manually" create this expression, it works.  When I try to run with the iterator, it ignores the "remove" logic and selects more features than to be expected.

GarrettMelvin_0-1725997299882.png

 

0 Kudos