<?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: Trying to concatenate 3 parameters to create a DDP page name to export PDF in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479576#M37520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The first thing I see is that your input parameters have some unclosed parenthesis. Also, I would recommend trying to print out the values of newpage and pageID as you go. It might yield some good insights on what is happening. Also since all you do with your Data Frame object (df) is create it and then delete it you can probably skip creating it all together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Doug&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Apr 2014 14:34:00 GMT</pubDate>
    <dc:creator>DouglasSands</dc:creator>
    <dc:date>2014-04-24T14:34:00Z</dc:date>
    <item>
      <title>Trying to concatenate 3 parameters to create a DDP page name to export PDF</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479575#M37519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to write a Python script so the user can export a PDF map from an MXD using data driven pages without the user having to open the MXD and scroll through all the data driven pages to find the page they need.&amp;nbsp; The Index Grid is the Section, Township, Range polygon.&amp;nbsp; The page name looks like this in the attribute table: T1N R70W S12.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to make it easier for the user, I broke up the STR into 3 separate parameters that have value lists so they can just pick their value from a drop down. The parameters are strings.&amp;nbsp; I'm running into problems trying to concatenate the 3 parameters into 1 string so the data driven pages can get the page ID from the page name.&amp;nbsp; The script runs with no errors, however, it also exports the firstpage in the mxd.&amp;nbsp; I can't get it to use the user defined parameters to identify the page name. I believe the issue is in line 24.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the script: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Setup&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from os import sep as bs&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Script arguments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FOLDER = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TNSHP = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RNG = (arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SCTN = (arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outPath = FOLDER + bs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = outPath&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Select and Zoom to Section Township Range&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = mapping.MapDocument(r"V:\gislu\_BasemapMXD\Assessor24x36.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;df = mapping.ListDataFrames(mxd, "Layers") [0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp = mxd.dataDrivenPages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("Finding Township Range Section") &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;newpage = TNSHP + " " + RNG + " " + SCTN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageID = ddp.getPageIDFromName(newpage)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp.currentPageID = pageID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Export PDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;finalPdf = outPath + "T" + TNSHP + "R" + RNG + "S" + SCTN + "ParcelMap.pdf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("Exporting PDF")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ddp.exportToPDF(finalPdf, 'CURRENT', resolution = 200)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage("DONE!")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd, df, ddp, pageID&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 13:51:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479575#M37519</guid>
      <dc:creator>MollyWatson</dc:creator>
      <dc:date>2014-04-24T13:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to concatenate 3 parameters to create a DDP page name to export PDF</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479576#M37520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The first thing I see is that your input parameters have some unclosed parenthesis. Also, I would recommend trying to print out the values of newpage and pageID as you go. It might yield some good insights on what is happening. Also since all you do with your Data Frame object (df) is create it and then delete it you can probably skip creating it all together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Doug&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 14:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479576#M37520</guid>
      <dc:creator>DouglasSands</dc:creator>
      <dc:date>2014-04-24T14:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to concatenate 3 parameters to create a DDP page name to export PDF</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479577#M37521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Doug. I removed the extra parenthesis.&amp;nbsp; Those were left over when I was experimenting making the parameters a string and I forgot to delete them. I added the print statements and ran the script in python.&amp;nbsp; My print statement = 1.&amp;nbsp; Then I get an error on the Export to PDF function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1&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 "V:\gislu\_BasemapMXD\STRMapSearch.py", line 33, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddp.exportToPDF(finalPdf, 'CURRENT', resolution = 200)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\utils.py", line 181, in fn_&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\_mapping.py", line 446, in exportToPDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return convertArcObjectToPythonObject(self._arc_object.exportToPDF(*gp_fixargs((out_pdf, page_range_type, page_range_string, multiple_files, resolution, image_quality, colorspace, compress_vectors, image_compression, picture_symbol, convert_markers, embed_fonts, layers_attributes, georef_info, jpeg_compression_quality, show_selection_symbology), True)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: PageLayoutObject: Error in exporting pages&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 15:03:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-concatenate-3-parameters-to-create-a-ddp/m-p/479577#M37521</guid>
      <dc:creator>MollyWatson</dc:creator>
      <dc:date>2014-04-24T15:03:54Z</dc:date>
    </item>
  </channel>
</rss>

