<?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 ModelBuilder SQL Expression Using Inline Variable %Value% for OD Cost Matrix in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-sql-expression-using-inline-variable/m-p/875122#M508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello GeoNet Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I originally posted a related question (&lt;A href="https://community.esri.com/thread/253233"&gt;Does anyone have experience with OD Cost Matrix and Iterate in ModelBuilder?&lt;/A&gt;)&amp;nbsp;back in May. I eventually figured out the problem, but since then we had our computers replaced and I lost the model and cannot figure out how I made it work last time. This is my model:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/511878_2020-10-27 172538 Model.jpg" /&gt;&lt;/P&gt;&lt;P&gt;The problem is with the expression to select Unique ID for Origins.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="/legacyfs/online/511879_2020-10-27 172845 Expression.jpg" /&gt;&lt;/P&gt;&lt;P&gt;The OUSEQID is the common field between the Origin and Destination. It is a string field, that is why I have quotations around the %Value%. This doesn't verify fully, but if I replace %Value% with a value of 56 it does work.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-3 j-img-original" src="/legacyfs/online/511964_2020-10-27 172845 Expression_Manual Success.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It feels to me at this point that the iterator is not feeding the value to this expression. Maybe I am off base, but that is my impression. Here are my model parameters:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-4 j-img-original" src="/legacyfs/online/511965_2020-10-27 174230 Model Share.jpg" /&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be very appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3174"&gt;Drew Flater&lt;/A&gt;‌ - Do you know where else I can get help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Oct 2020 00:49:00 GMT</pubDate>
    <dc:creator>ShannonMurphy2</dc:creator>
    <dc:date>2020-10-28T00:49:00Z</dc:date>
    <item>
      <title>ModelBuilder SQL Expression Using Inline Variable %Value% for OD Cost Matrix</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-sql-expression-using-inline-variable/m-p/875122#M508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello GeoNet Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I originally posted a related question (&lt;A href="https://community.esri.com/thread/253233"&gt;Does anyone have experience with OD Cost Matrix and Iterate in ModelBuilder?&lt;/A&gt;)&amp;nbsp;back in May. I eventually figured out the problem, but since then we had our computers replaced and I lost the model and cannot figure out how I made it work last time. This is my model:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="/legacyfs/online/511878_2020-10-27 172538 Model.jpg" /&gt;&lt;/P&gt;&lt;P&gt;The problem is with the expression to select Unique ID for Origins.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-2 j-img-original" src="/legacyfs/online/511879_2020-10-27 172845 Expression.jpg" /&gt;&lt;/P&gt;&lt;P&gt;The OUSEQID is the common field between the Origin and Destination. It is a string field, that is why I have quotations around the %Value%. This doesn't verify fully, but if I replace %Value% with a value of 56 it does work.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-3 j-img-original" src="/legacyfs/online/511964_2020-10-27 172845 Expression_Manual Success.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It feels to me at this point that the iterator is not feeding the value to this expression. Maybe I am off base, but that is my impression. Here are my model parameters:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji jive-image image-4 j-img-original" src="/legacyfs/online/511965_2020-10-27 174230 Model Share.jpg" /&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be very appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3174"&gt;Drew Flater&lt;/A&gt;‌ - Do you know where else I can get help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2020 00:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-sql-expression-using-inline-variable/m-p/875122#M508</guid>
      <dc:creator>ShannonMurphy2</dc:creator>
      <dc:date>2020-10-28T00:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: ModelBuilder SQL Expression Using Inline Variable %Value% for OD Cost Matrix</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-sql-expression-using-inline-variable/m-p/1088123#M509</link>
      <description>&lt;P&gt;I was looking for unanswered questions and came across this. My advice is to use the Calculate Value tool to build the SQL expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"OUSEQID = '{}'".format('%Value%')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then set the output to type SQL Expression and connect it to the Select Layer By Attribute tool.&amp;nbsp; I would also connect the variable named Value to the Select Layer By Attribute tool as a precondition to make sure the Calculate Value tool runs first.&lt;/P&gt;&lt;P&gt;Preconditions can sometimes be the issue with iterators as you want to make sure all inputs are up to date for that iteration. You may be able to just connect Value to Select Layer By Attributes tool and that would solve your problem without the intermediate step, but I like the clarity and flexibility of using Calculate Value to build expressions.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 20:31:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/modelbuilder-sql-expression-using-inline-variable/m-p/1088123#M509</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-08-11T20:31:03Z</dc:date>
    </item>
  </channel>
</rss>

