<?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: Passing Variable to Nested Iterator in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851689#M2216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the Parameter from your sub-model called PathResults is used as a workspace in the sub-model? If you want to use the current workspace that the iterator is spitting out then you need only type into PathResults the inline substitution %Workspace%. Currently it appears you have the output of the iterator as a precondition to your sub-model (dashed line), you do not need that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Oct 2017 13:16:53 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2017-10-17T13:16:53Z</dc:date>
    <item>
      <title>Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851688#M2215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am processing a large set of data to do least cost path analysis from a lot of point sources.&amp;nbsp; To speed things up I am chopping up all of the source data into a series of geodatabases.&amp;nbsp; My LCP model iterates through each point in the gdb and solves the path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is iterate through the gdbs (244 No.) and store the results just in that gdb (I'll put the data back together later).&amp;nbsp; I may just be being a bit dim, but I can't work out how to pass the name of the current workspace into my sub-model for it to pick up the inputs it needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have exposed my sub-model inputs so that they show up in my main model,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/380229_pastedImage_1.png" style="width: 429px; height: 437px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And made them like this,&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/380230_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this clearly isn't correct as it doesn't validate.&amp;nbsp; If I run just the iterator in the main model and then set these inputs manually to exactly the same as above (but don't validate it), the sub-model does run for the last workspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've thought about simplifying it so that I only need to get my first input parameters from the main model and can then get the workspace for this in the sub-model, and whilst this would look neater but I still have the same initial problem of getting the workspace variable into that parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect I am missing something really obvious!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 07:07:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851688#M2215</guid>
      <dc:creator>SimonGee</dc:creator>
      <dc:date>2017-10-17T07:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851689#M2216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the Parameter from your sub-model called PathResults is used as a workspace in the sub-model? If you want to use the current workspace that the iterator is spitting out then you need only type into PathResults the inline substitution %Workspace%. Currently it appears you have the output of the iterator as a precondition to your sub-model (dashed line), you do not need that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2017 13:16:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851689#M2216</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2017-10-17T13:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851690#M2217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried to simplify this, but still not quite got it working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a Workspace variable in my sub-model as a Parameter and referred everything else in that model to %workspace%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I add the sub-model to the main model I can connect the Iterator output to it as Workspace.&amp;nbsp; If my main model has already been run (so the GDB_Name has a value) before I add in the sub-model, it is all OK, and the sub-model will run, but obviously only on the last Workspace the iterator found.&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/380343_pastedImage_1.png" style="width: 351px; height: 144px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I then Validate the main model, if breaks the sub-model.&amp;nbsp; Is this because there is no longer a value in GDB_Name to act as the Workspace variable for the sub-model?&amp;nbsp; If so, how do I get around this?&amp;nbsp; I still think I'm missing something blindingly obvious!!&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/380344_pastedImage_2.png" style="width: 339px; height: 123px;" /&gt;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2017 11:18:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851690#M2217</guid>
      <dc:creator>SimonGee</dc:creator>
      <dc:date>2017-10-18T11:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851691#M2218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your original model the iterator is creating an output named &lt;STRONG&gt;Workspace&lt;/STRONG&gt; so you use &lt;STRONG&gt;%Workpace%&lt;/STRONG&gt; to pass this value into the sub model parameter. You have now renamed that to &lt;STRONG&gt;GDB_Name&lt;/STRONG&gt; so to pass that you would use &lt;STRONG&gt;%GDB_Name%&lt;/STRONG&gt; as that is what you are now calling it. Worth reading the Help file on inline substitution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2017 13:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851691#M2218</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2017-10-18T13:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851692#M2219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Duncan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the swift response.  I started with that, and have now changed it back to Workspace, but it doesn’t make any difference.  The behaviour is exactly the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what the start of the sub model looks like…..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2017 14:10:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851692#M2219</guid>
      <dc:creator>SimonGee</dc:creator>
      <dc:date>2017-10-18T14:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851693#M2220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a "feature" of Model Builder that validating an iterator breaks its output. I suggest getting it all ready to go and then do not validate, just run it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the validating system totally keeps me from getting things done, I have worked around it by running the submodel in a Python script inside Calculate Value.&amp;nbsp; (Import toolbox, pass parameters to the model tool, return result with data type set). Yes, painful, but sometimes worth not going all the way to a full Python script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a suggestion: %workspace% is a built-in model variable that references the current environment workspace. You&amp;nbsp;should use another variable name that will not conflict, like "Working GDB"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 23:37:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851693#M2220</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-10-19T23:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Variable to Nested Iterator</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851694#M2221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your sub-model you have created a variable called workspace and exposed it as a parameter but it is not connected to anything in your model, so will do nothing. The other variable (tm_segment_centers) which is connected to the iterator is not exposed as a parameter so won't get exposed to the master model. Suggest you delete the variable workspace and make the input to the iterator the parameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Oct 2017 10:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/passing-variable-to-nested-iterator/m-p/851694#M2221</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2017-10-20T10:06:51Z</dc:date>
    </item>
  </channel>
</rss>

