<?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: Python Table to HTML in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634711#M21145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would get a list of tables, create a loop that iterates the list like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for table in tables:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create table search cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur = gp.SearchCursor(tablePath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;td&amp;gt;" + str(row.getValue(fieldName)) + "&amp;lt;/td&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;/tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del cur

&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:59:55 GMT</pubDate>
    <dc:creator>AndrewChapkowski</dc:creator>
    <dc:date>2021-12-12T02:59:55Z</dc:date>
    <item>
      <title>Python Table to HTML</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634710#M21144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Basically I have a small python script that is converting one table to a HTML file...Very nice and cleanly.&amp;nbsp; But I want to convert multiple table to the same HTML file and maybe have multiple tables with the HTML.&amp;nbsp; Can someone help me with this or point me in the right direction.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code I have (I didn't write this code, a friend pointed me to it, it was posted in another post)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
 # ---------------------------------------------------------------------------
# TableToHtml.py
# ---------------------------------------------------------------------------

import sys, string, os, arcgisscripting
gp = arcgisscripting.create(9.3)

tablePath = gp.GetParameterAsText(0)
filePath = gp.GetParameterAsText(1)

outfile = open(filePath, "w")
fields = gp.ListFields(tablePath)

fieldNames = []
for field in fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (field.type &amp;lt;&amp;gt; "Geometry" and field.type &amp;lt;&amp;gt; "BLOB"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldNames.append(field.name)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
outfile.write("&amp;lt;table border=""1""&amp;gt;\n")

outfile.write("&amp;lt;tr&amp;gt;\n")
for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;th&amp;gt;" + fieldName + "&amp;lt;/th&amp;gt;\n")&amp;nbsp;&amp;nbsp;&amp;nbsp; 

outfile.write("&amp;lt;/tr&amp;gt;\n")

cur = gp.SearchCursor(tablePath)
row = cur.Next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;td&amp;gt;" + str(row.getValue(fieldName)) + "&amp;lt;/td&amp;gt;\n")

&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;/tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
del cur

outfile.write("&amp;lt;/table&amp;gt;\n")

outfile.flush()
outfile.close()

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 20:53:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634710#M21144</guid>
      <dc:creator>DavidAshton</dc:creator>
      <dc:date>2010-08-12T20:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python Table to HTML</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634711#M21145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would get a list of tables, create a loop that iterates the list like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for table in tables:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create table search cursor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur = gp.SearchCursor(tablePath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fieldName in fieldNames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;td&amp;gt;" + str(row.getValue(fieldName)) + "&amp;lt;/td&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outfile.write("&amp;lt;/tr&amp;gt;\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del cur

&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:59:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634711#M21145</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-12T02:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Python Table to HTML</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634712#M21146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Andrew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will give your code a shot.&amp;nbsp; I was hoping to ask you one more easier question.&amp;nbsp; I want to the users to be able to create a title for my HTML but I'm having trouble setting it up.&amp;nbsp; I thought it would be as easy as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;htmlTitle = gp.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;outfile.write(htmlTitle)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then when I add the script to a model or a toolbox and run from ArcMap &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I right click the script &amp;gt; go to Parameters tab &amp;gt; and set the DataType to string (for the htmlTitle parameter) and I set type to required, Direction to Input, Multi to No, Filter to none, all the rest I leave blank.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In arcmap everything is fine and the user has a text box to enter the name of title, but in server I don't see that text box.&amp;nbsp; So how do I make that text box appear in Server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Aug 2010 19:08:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-table-to-html/m-p/634712#M21146</guid>
      <dc:creator>DavidAshton</dc:creator>
      <dc:date>2010-08-19T19:08:01Z</dc:date>
    </item>
  </channel>
</rss>

