<?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: Loop to make layers and create maps in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62997#M5100</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If it is a string field it will need to be formatted as such. Something like this should work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;where =&amp;nbsp; "[survey_month] = '" + value + "'"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try building a sample query in arcmap to get your formatting down.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Mar 2012 19:00:29 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2012-03-05T19:00:29Z</dc:date>
    <item>
      <title>Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62991#M5094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a python script (arcpy) that is used to create a list of unique values of a field, then I want to loop through those values and make a feature layer for each, update map text, update symbology, and export to a PDF.&amp;nbsp; So far, the issue seems to be linking the value of the field in the feature class with the value in the unique values list.&amp;nbsp; The script appears to work aside from this (i.e. exports nice maps with no data).&amp;nbsp; Can anyone help me with that link and the where clause in the MakeFeatureLayer tool?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy.mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutputs = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;inFC = r"F:\DATA\PROJECTS\RUBL\layers\RUBL.gdb\National_bothtimeperiods"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;inField = "survey_month"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"F:\DATA\PROJECTS\RUBL\workspaces\RUBL_National_Monthly.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outloc = r"F:\DATA\PROJECTS\RUBL\maps\Month"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sourcelayer = arcpy.mapping.ListLayers(mxd, "Survey Records", df)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;valueList = []&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.SearchCursor(inFC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; aVal = row.getValue(inField)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if aVal not in valueList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueList.append(aVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;del row, rows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print valueList&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for value in valueList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #make feature layer where survey_month field equals the current value in the unique list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lyrbase = "MonthLyr"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; val = str(value)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lyrname = lyrbase + value&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.MakeFeatureLayer_management(inFC, lyrname, "[survey_month] = value")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.RefreshTOC()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #update symbology based on layer in mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd, lyrname,df):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.UpdateLayer(df, lyrname, sourcelayer, True)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #change the text element to read the month of the current unique value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "Month"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.text = "Month: " + value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #export to PDF with settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; outfile = outloc + value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, outfile, data_frame="PAGE_LAYOUT", resolution=300, image_quality="BEST", colorspace="CMYK", image_compression="LZW", convert_markers="True", embed_fonts="True") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #remove the current layer so that the next can be created and mapped correctly&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; for df in arcpy.mapping.ListDataFrames(mxd):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd, lyrname, df):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, lyr)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 16:14:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62991#M5094</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2012-03-05T16:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62992#M5095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The statement 'val = str(value)' implies that value is not a string, but on the next line 'lyrname = lyrbase + value' you're trying to append it onto the end of a string. Do you want to use 'lyrname = lyrbase + val' instead?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 17:36:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62992#M5095</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-03-05T17:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62993#M5096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is probably more what you want. I assume you aren't looking for an attribute of "value". Also, I am not sure if the square brackets are needed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
where =&amp;nbsp; "[survey_month] = " + value
arcpy.MakeFeatureLayer_management(inFC, lyrname, where)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62993#M5096</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-10T22:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62994#M5097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The statement 'val = str(value)' implies that value is not a string, but on the next line 'lyrname = lyrbase + value' you're trying to append it onto the end of a string. Do you want to use 'lyrname = lyrbase + val' instead?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, you are right, the layername should have the string version attached&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 18:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62994#M5097</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2012-03-05T18:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62995#M5098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is probably more what you want. I assume you aren't looking for an attribute of "value". Also, I am not sure if the square brackets are needed.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
where =&amp;nbsp; "[survey_month] = " + value
arcpy.MakeFeatureLayer_management(inFC, lyrname, where)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried this solution but I'm getting an error as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "F:\DATA\PROJECTS\RUBL\docs\month_mapping.py", line 34, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = "[survey_month] = " + value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TypeError: cannot concatenate 'str' and 'float' objects&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:24:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62995#M5098</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2021-12-10T22:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62996#M5099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is probably more what you want. I assume you aren't looking for an attribute of "value". Also, I am not sure if the square brackets are needed.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
where =&amp;nbsp; "[survey_month] = " + value
arcpy.MakeFeatureLayer_management(inFC, lyrname, where)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oh, I think that is because I was using the float value not the one converted to a string, used the val variable instead with your solution but am still getting no data showing up on the final map...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62996#M5099</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2021-12-10T22:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62997#M5100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If it is a string field it will need to be formatted as such. Something like this should work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;where =&amp;nbsp; "[survey_month] = '" + value + "'"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;You can try building a sample query in arcmap to get your formatting down.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 19:00:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62997#M5100</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-03-05T19:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62998#M5101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If it is a string field it will need to be formatted as such. Something like this should work.&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;where =&amp;nbsp; "[survey_month] = '" + value + "'"&lt;/PRE&gt;&lt;BR /&gt;You can try building a sample query in arcmap to get your formatting down.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem is that it is not a string field...it is a double with values between 1 and 12 for month.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 19:16:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62998#M5101</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2012-03-05T19:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62999#M5102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try posting the code you are using now with the &lt;PRE&gt; tags so it is formatted properly.&lt;/PRE&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it is just 1-12, you could just use an integer, but that is beside the point. Have you put an arcpy.RefreshActiveView() in after you add your layers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Mar 2012 19:26:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/62999#M5102</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-03-05T19:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/63000#M5103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Try posting the code you are using now with the &lt;PRE class="lia-code-sample line-numbers language-none"&gt; tags so it is formatted properly.

If it is just 1-12, you could just use an integer, but that is beside the point. Have you put an arcpy.RefreshActiveView() in after you add your layers?&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a special way to format a variable to be read as an integer within a where clause?&amp;nbsp; I added in the refresh function, but still get blank outputs (supposedly because nothing "equals the variable")....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;valueList = []&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.SearchCursor(inFC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for row in rows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; aVal = row.getValue(inField)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if aVal not in valueList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; valueList.append(aVal)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del row, rows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print valueList&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for value in valueList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; #make feature layer where survey_month field equals the current value in the unique list&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lyrbase = "MonthLyr"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; val = str(value) #this is done just so I can use it for naming&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; lyrname = lyrbase + val&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.MakeFeatureLayer_management(inFC, lyrname, "[survey_month] = value")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 15:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/63000#M5103</guid>
      <dc:creator>EvaJenkins</dc:creator>
      <dc:date>2021-12-12T15:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Loop to make layers and create maps</title>
      <link>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/63001#M5104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I meant the field type as integer. But that is really outside the scope of what you are doing here. You're where clause is still not formatted properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This won't work unless your month is called "value"&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.MakeFeatureLayer_management(inFC, lyrname, "[survey_month] = value")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should work for you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;where =&amp;nbsp; "[survey_month] = " + str(value)
arcpy.MakeFeatureLayer_management(inFC, lyrname, where)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:24:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/loop-to-make-layers-and-create-maps/m-p/63001#M5104</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-10T22:24:38Z</dc:date>
    </item>
  </channel>
</rss>

