Solved

Frontpage From to CSV

Posted on 2003-10-28
7
517 Views
Last Modified: 2013-12-24
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
Comment
Question by:ctgordon
  • 5
  • 2
7 Comments
 
LVL 14

Expert Comment

by:hhammash
ID: 9637239
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
 
LVL 14

Accepted Solution

by:
hhammash earned 500 total points
ID: 9637333
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
 
LVL 14

Expert Comment

by:hhammash
ID: 9637352
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:ctgordon
ID: 9642607
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
 

Author Comment

by:ctgordon
ID: 9643110
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
 
LVL 14

Expert Comment

by:hhammash
ID: 9643397
Try to put your code before the select statement


hhammash
0
 
LVL 14

Expert Comment

by:hhammash
ID: 9643577
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now