• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Frontpage From to CSV

I need to take a Frontpage Form.  (Not my choice, I inherited FP) and build wither an ASP or VB script to Take the form results and post it in a CSV file.  I can't figure out these FP bots.  They seem to spawn from H@%L. Anyway here is the code. for the page.

<!--webbot bot="DatabaseRegionStart" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-columntypes="135,135,200,200,200,200,200" s-dataconnection="Trans_adwrsql1" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="FALSE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns="SITE_LOCAL_ID,M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,TEMPERATURE" s-criteria s-order s-sql="SELECT * FROM WebTrans WHERE (SITE_LOCAL_ID LIKE '::SensorIDs::' AND M_DATE &gt;= '::D1Month::/::D1Day::/::D1Year::' AND M_DATE &lt;= '::D2Month::/::D2Day::/::D2Year::') ORDER BY M_DATE ASC,M_TIME ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="SensorIDs=&amp;D1Month=&amp;D1Day=&amp;D1Year=&amp;D2Month=&amp;D2Day=&amp;D2Year=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="50" botid="0" u-dblib="../../_fpclass/fpdblib.inc" u-dbrgn1="../../_fpclass/fpdbrgn1.inc" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM WebTrans WHERE (SITE_LOCAL_ID LIKE '::SensorIDs::' AND M_DATE >= '::D1Month::/::D1Day::/::D1Year::' AND M_DATE <= '::D2Month::/::D2Day::/::D2Year::') ORDER BY M_DATE ASC,M_TIME ASC"
fp_sDefault="SensorIDs=&D1Month=&D1Day=&D1Year=&D2Month=&D2Day=&D2Year="
fp_sNoRecords="<tr><td colspan=6 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Trans_adwrsql1"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=50
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan --><tr>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="SITE_LOCAL_ID" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;SITE_LOCAL_ID&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"SITE_LOCAL_ID")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="M_DATE" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;M_DATE&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"M_DATE")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="M_TIME" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;M_TIME&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"M_TIME")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="DEPTH_TO_WATER" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;DEPTH_TO_WATER&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"DEPTH_TO_WATER")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="WATER_LEVEL_ELEVATION" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;WATER_LEVEL_ELEVATION&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"WATER_LEVEL_ELEVATION")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
      <td>
      <!--webbot bot="DatabaseResultColumn" s-columnnames="M_DATE,M_TIME,DEPTH_TO_WATER,WATER_LEVEL_ELEVATION,DATA_SOURCE,TEMPERATURE,SITE_LOCAL_ID" s-column="TEMPERATURE" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;TEMPERATURE&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"TEMPERATURE")%><!--webbot bot="DatabaseResultColumn" endspan --></td>
    </tr>
    <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../../_fpclass/fpdbrgn2.inc" i-groupsize="50" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;TR&gt;&lt;TD ALIGN=LEFT VALIGN=MIDDLE COLSPAN=64&gt;&lt;NOBR&gt;&lt;INPUT TYPE=Button VALUE=&quot;  |&lt;  &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot;   &lt;  &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot;  &gt;   &quot;&gt;&lt;INPUT TYPE=Button VALUE=&quot;  &gt;|  &quot;&gt;  [1/50]&lt;/NOBR&gt;&lt;BR&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan --></tbody>
</table>
<B>

I tried to put this code in
<%
logon=Request("LOGON_USER")
 logon=Right(logon,len(logon)-InStr(logon, "\"))
 if len(logon) <= 0 then logon="unknown"
 filename="e:\inetpub\wwwroot\fieldservices\content\Search\" & logon & ".csv"
 url="http://www.water.az.gov/fieldservices/content/Search/" & logon &".csv"
 'end if %>
 <%Set fs = CreateObject("Scripting.FileSystemObject")
 Set output = fs.CreateTextFile(filename, True)
' CRLF = CHR(13) & CHR(10)%>
 <%for each field in Request.Form
                output.write (""" & fp_sDefault & "",")%>  
 <%  next
 output.write(CRLF)
output.Close
%>

but it does not work because the stream to the page happens in the bots. This results page is just the final reult.  HELP!
0
ctgordon
Asked:
ctgordon
  • 5
  • 2
1 Solution
 
hhammashCommented:
Hi,

To send Frontpage form results to a CSV file is easy:
http://www.frontpagetalk.com/forums/form_results_into_an_external_excel_file%3F/m_47679/p_1/tmode_11/smode_1/tm.htm

But if you wish to edit the code that Frontpage Generates you have to use Spooky Diet.  Here in this link you will see how to edit an FP generated code and edit the ASP.  Now if you try to edit the ASP most of your work will not be saved. You have to remove parts of the code above to be able to add your own.

www.outfront.net

regards
hhammash


0
 
hhammashCommented:
Hi,
This is how your page should look like after removing the FP generated code.  Remove all
the code that you don't see below.  I took a copy of your page and cleaned the code.
After you do that,  save the page (.asp of course) then you can edit and add your code which
will be saved and the bots will not interfere.

Here is the clean code:

<!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM WebTrans WHERE (SITE_LOCAL_ID LIKE '::SensorIDs::' AND M_DATE >= '::D1Month::/::D1Day::/::D1Year::' AND M_DATE <= '::D2Month::/::D2Day::/::D2Year::') ORDER BY M_DATE ASC,M_TIME ASC"
fp_sDefault="SensorIDs=&D1Month=&D1Day=&D1Year=&D2Month=&D2Day=&D2Year="
fp_sNoRecords="<tr><td colspan=6 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Trans_adwrsql1"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=50
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
      <td>
      <%=FP_FieldVal(fp_rs,"SITE_LOCAL_ID")%>
      </td>
      <td>
      <%=FP_FieldVal(fp_rs,"M_DATE")%>
       </td>
      <td>
      <%=FP_FieldVal(fp_rs,"M_TIME")%>
      </td>
      <td>
      <%=FP_FieldVal(fp_rs,"DEPTH_TO_WATER")%>
       </td>
      <td>
      <%=FP_FieldVal(fp_rs,"WATER_LEVEL_ELEVATION")%>
      </td>
      <td>
       <%=FP_FieldVal(fp_rs,"TEMPERATURE")%>
       </td>
    </tr>
<!--#include file="../../_fpclass/fpdbrgn2.inc"-->
</tbody>
</table>


Of course before the code you have the form and HTML code,  you did not put your page complete.  
But this is the main part that needs changing.

regards
hhammash
0
 
hhammashCommented:
Hi again,

Here is the direct link to Spooky diet method:
www.outfront.net/spooky/adv_drw_diet.htm 

I tried the website now but it is not opening.

Anyway the cleanup above is what you should end up with.

Regards
hhammash
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
ctgordonAuthor Commented:
hhammash,  Thanks  I like the spooky diet.  Very nice.  What I need is both the form and a CSV file.  I seems Frontpade 2002 does a nice job of one or the other but not both.  Any thoughts??
0
 
ctgordonAuthor Commented:
Here is how my code is looking but the CSV creation does not work. Help
<!--#include file="../../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM WebTrans WHERE (SITE_LOCAL_ID LIKE '::SensorIDs::' AND M_DATE >= '::D1Month::/::D1Day::/::D1Year::' AND M_DATE <= '::D2Month::/::D2Day::/::D2Year::') ORDER BY M_DATE ASC,M_TIME ASC"
fp_sDefault="SensorIDs=&D1Month=&D1Day=&D1Year=&D2Month=&D2Day=&D2Year="
fp_sNoRecords="<tr><td colspan=6 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Trans_adwrsql1"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=50
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=6
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../../_fpclass/fpdbrgn1.inc"-->
<tr>
      <td>
      <%=FP_FieldVal(fp_rs,"SITE_LOCAL_ID")%></td>
      <td>
      <%=FP_FieldVal(fp_rs,"M_DATE")%></td>
      <td>
      <%=FP_FieldVal(fp_rs,"M_TIME")%></td>
      <td>
      <%=FP_FieldVal(fp_rs,"DEPTH_TO_WATER")%></td>
      <td>
      <%=FP_FieldVal(fp_rs,"WATER_LEVEL_ELEVATION")%></td>
      <td>
      <%=FP_FieldVal(fp_rs,"TEMPERATURE")%></td>
    </tr>
<%
logon=Request("LOGON_USER")
 logon=Right(logon,len(logon)-InStr(logon, "\"))
 if len(logon) <= 0 then logon="unknown"
 filename="e:\inetpub\wwwroot\fieldservices\content\Search\" & logon & ".csv"
 url="http://www.water.az.gov/fieldservices/content/Search/" & logon &".csv"
 'end if %>
 <%Set fs = CreateObject("Scripting.FileSystemObject")
 Set output = fs.CreateTextFile(filename, True)
' CRLF = CHR(13) & CHR(10)%>
 <%for each FP_FieldVal in SensorIDs
 output.writeLine FP_FieldVal(fp_rs,"SITE_LOCAL_ID")  
 next
 output.writeLine(CRLF)
output.Close
%>

<!--#include file="../../_fpclass/fpdbrgn2.inc"-->
0
 
hhammashCommented:
Try to put your code before the select statement


hhammash
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now