<?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: Lookup Table in Model Builder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694379#M53843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was able to take your script and with some slight modifications, I think it's going to work for what I need!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Really appreciate the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Aug 2014 18:54:03 GMT</pubDate>
    <dc:creator>DanielHorn</dc:creator>
    <dc:date>2014-08-18T18:54:03Z</dc:date>
    <item>
      <title>Lookup Table in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694377#M53841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to build a process in Model Builder that takes several SDE Feature Classes (all named M_X_*) and exports them to shape files in a given directory. This seems easy enough, but there are two issues that I'm not sure how to address:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Each shape file that gets exported needs to be renamed to something different, with no logic behind the naming convention (M_X_CASING becomes xCasing, M_X_AERIAL_MARKER becomes xAirMrkr, etc.)&lt;/LI&gt;&lt;LI&gt;One of the feature classes is too large and needs to be split into two shape files. Essentially, we use a where clause and just export it twice.&lt;/LI&gt;&lt;/OL&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the past, this entire process was done using a command line script and the sde2shp.exe ArcSDE Utility, but we'd like to get away from that. I was thinking we could wrap all of this into a geoprocessing service that could be executed on demand through ArcMap.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this using the model builder? Maybe a way we could build a lookup table with the feature class name, the name of the exported file, and the where clause, and then iterate through it? Or would I be better off writing a custom python script to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:04:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694377#M53841</guid>
      <dc:creator>DanielHorn</dc:creator>
      <dc:date>2014-07-31T20:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Table in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694378#M53842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;The limited (if any) options to manipulate strings like file paths in model builder quickly turned me to Python, where things like that area easy to do. Here is how to core of the script you described might look like. I would have to try that and tweak it to be able to publish that as a service, but hopefully it is clear enough to get you started.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14068391907283227 jive_text_macro" jivemacro_uid="_14068391907283227"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;import os&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;osj = os.path.join # define shortcut for a function&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# if you need inputs, get them like so:&lt;/P&gt;
&lt;P&gt;#some_input = arcpy.GetParameterAsText(0)&lt;/P&gt;
&lt;P&gt;#some_other_input = arcpy.GetParameter(1)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;sde = 'Database Connections\database_connection.sde'&lt;/P&gt;
&lt;P&gt;ows = r'c:\output\workspace'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# lookup of feature class - exported file name - where clause&lt;/P&gt;
&lt;P&gt;lookup = [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (osj(sde, 'M_X_CASING'), osj(ows, 'xCasing'), ''),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (osj(sde, 'M_X_AERIAL_MARKER'), osj(ows, 'xAirMrkr'), ''),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (osj(sde, 'M_X_WITHWHERE'), osj(ows, 'xWhere1'), '"COLUMN"=\'high\''),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (osj(sde, 'M_X_WITHWHERE'), osj(ows, 'xWhere1'), '"COLUMN"=\'low\'')&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #, ...&lt;/P&gt;
&lt;P&gt;]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;exported = []&lt;/P&gt;
&lt;P&gt;for item in lookup:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = item[0]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out = item[1]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wc = item[2]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result_i = arcpy.analysis.Select(fc, out, wc).getOutput(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exported.append(result_i)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# exported is now a list of results but you may not need that&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# you will definitely need to set some output, like so:&lt;/P&gt;
&lt;P&gt;arcpy.SetParameter(1, exported[0])&lt;/P&gt;
&lt;P&gt;# you may want to zip the whole output directory and&lt;/P&gt;
&lt;P&gt;# set the zip file as output&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;# &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//005700000078000000" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//005700000078000000&lt;/A&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2014 20:40:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694378#M53842</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2014-07-31T20:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Table in Model Builder</title>
      <link>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694379#M53843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I was able to take your script and with some slight modifications, I think it's going to work for what I need!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Really appreciate the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 18:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/lookup-table-in-model-builder/m-p/694379#M53843</guid>
      <dc:creator>DanielHorn</dc:creator>
      <dc:date>2014-08-18T18:54:03Z</dc:date>
    </item>
  </channel>
</rss>

