<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Expression substitution using wildcards and variables in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720413#M23864</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think the result window shows it more clearly whats going on:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%String%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(String = "music") it is doing this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Start Time: Wed Sep 07 16:24:20 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE 'music'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;instead of ""Tags" LIKE '%music%'".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, when I enter myself %music% as the Parameter for String, it is doing this - the correct query:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Start Time: Wed Sep 07 16:24:45 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE '%music%'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[edit]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Great - finally found a solution, although it looks a little bit strange:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have now 2 Variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tagname = "music"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perc I'll define as "%"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;looks like this in the Expression of the Select-Query:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%Perc%%Tagname%%Perc%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and is doing this after run:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Start Time: Wed Sep 07 16:49:39 2011&lt;BR /&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE '%music%'"&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Sep 2011 22:27:47 GMT</pubDate>
    <dc:creator>AlexanderDunkel</dc:creator>
    <dc:date>2011-09-07T22:27:47Z</dc:date>
    <item>
      <title>Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720408#M23859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a problem I can not somehow solve on my own: I am trying to make a Select Query in ModelBuilder, using a substitution of a User-Input String and an Expression with Wildcards. The problem is, that I need to use the %-Wildcard, and thats the same as for the string-substitution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This one works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%music%' whereas this one works not (with the input-string):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%%string%%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried all sorts of combinations, like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%'%string%'%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""Tags" LIKE '%"""%string%"""%'"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but it is giving me errors all the time. Do you know the correct format of this query?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 18:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720408#M23859</guid>
      <dc:creator>AlexanderDunkel</dc:creator>
      <dc:date>2011-09-07T18:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720409#M23860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you add a snapshot of your model and the select query dialog?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How/Why/Where are you using the wild card substitution?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These wont work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%%string%%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%'%string%'%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""Tags" LIKE '%"""%string%"""%'"""&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 20:47:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720409#M23860</guid>
      <dc:creator>ShitijMehta</dc:creator>
      <dc:date>2011-09-07T20:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720410#M23861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello shitijmehta,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I attached 4 images:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;modelb1.jpg shows the Modelview with the Select-task (where I am having the problem) and modelb2.jpg the Select-task configuration. In this case, I am getting the Expression from outside (modelb3.jpg). But instead of putting the final text in the Expression ("Tags" LIKE '%music%') I want to use the String-Parameter (modelb4.jpg) and use that one instead of the part "music" in the Expression. So you can enter the search-string while opening the programm. I don't know how to substitute the expression with the wildcards % and the String-Variable (which would also need % before/after).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this make sense to you?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 21:07:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720410#M23861</guid>
      <dc:creator>AlexanderDunkel</dc:creator>
      <dc:date>2011-09-07T21:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720411#M23862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In the expression variable &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%String%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is enough as at the run time the %string% will be replace by the value of the string i.e. music&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what you are doing: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are creating a variable for a wild card that you want to use. This variable is of data type string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The name of the variable is String (rename it to something else- xyz and use- "Tags" LIKE '%xyx%')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are substituting the variable name %String%/%xyz% in the expression&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 21:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720411#M23862</guid>
      <dc:creator>ShitijMehta</dc:creator>
      <dc:date>2011-09-07T21:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720412#M23863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Try:&lt;BR /&gt;In the expression variable &lt;BR /&gt;&lt;BR /&gt;"Tags" LIKE '%String%'&lt;BR /&gt;&lt;BR /&gt;This is enough as at the run time the %string% will be replace by the value of the string i.e. music&lt;BR /&gt;&lt;BR /&gt;This is what you are doing: &lt;BR /&gt;You are creating a variable for a wild card that you want to use. This variable is of data type string.&lt;BR /&gt;The name of the variable is String (rename it to something else- xyz and use- "Tags" LIKE '%xyx%')&lt;BR /&gt;You are substituting the variable name %String%/%xyz% in the expression&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, this isn't working - I tried it before. When I do it like this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%String%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where the variable string = "music" it wont select any feature, but with this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%music%' &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;it will select more than 100 features. From my understanding - I am not really an expert, so please ignore if I am saying something wrong - for inline-substitution of String-Variables you need the Variable name, enclosed by %%. For my Select-Expression, I also need enclosing %% before and after the search-tearm as wildcards. I want to select all Features, that have music in the Tag-Coulm (even if its like abcdmusicdefg etc.). Therefore, I need the %-Wildcards. Logically, my Expressio should look like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%%String%%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The inner %% for the Variable-String I am getting as a Parameter from the User and the outer %% as Wildcards in the expression. But this gives me an error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 21:53:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720412#M23863</guid>
      <dc:creator>AlexanderDunkel</dc:creator>
      <dc:date>2011-09-07T21:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720413#M23864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think the result window shows it more clearly whats going on:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%String%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(String = "music") it is doing this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Start Time: Wed Sep 07 16:24:20 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE 'music'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;instead of ""Tags" LIKE '%music%'".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, when I enter myself %music% as the Parameter for String, it is doing this - the correct query:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Start Time: Wed Sep 07 16:24:45 2011&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE '%music%'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[edit]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Great - finally found a solution, although it looks a little bit strange:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have now 2 Variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tagname = "music"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perc I'll define as "%"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;looks like this in the Expression of the Select-Query:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"Tags" LIKE '%Perc%%Tagname%%Perc%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and is doing this after run:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Start Time: Wed Sep 07 16:49:39 2011&lt;BR /&gt;Executing (Select): Select Locations\xxx C:\xxx ""Tags" LIKE '%music%'"&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 22:27:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720413#M23864</guid>
      <dc:creator>AlexanderDunkel</dc:creator>
      <dc:date>2011-09-07T22:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720414#M23865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am glad you found a workaround. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what we found from our testing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"%string%" - Works&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"%string%%" - Works&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"%%string%%" - Unfortunately fails. We will work on fixing it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Meanwhile there is another workaround.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See attached image and the toolbox (version 10).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 16:05:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720414#M23865</guid>
      <dc:creator>ShitijMehta</dc:creator>
      <dc:date>2011-09-08T16:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Expression substitution using wildcards and variables</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720415#M23866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! Your solution looks cleaner - I was trying around with "+" Phyton String Substitution, but couldn't get it to work. This is a nice example. Thank you for your reply.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 16:19:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/expression-substitution-using-wildcards-and/m-p/720415#M23866</guid>
      <dc:creator>AlexanderDunkel</dc:creator>
      <dc:date>2011-09-08T16:19:33Z</dc:date>
    </item>
  </channel>
</rss>

