pixelRONIN
Technical User
Hello,
I have parsed a whatever-delimited txt file this way. Thanks George for the the reply!
==============================================
<%
DIM databaseMonths(12)
databaseMonths(0) = "jan"
databaseMonths(1) = "feb"
databaseMonths(2) = "mar"
databaseMonths(3) = "apr"
databaseMonths(4) = "may"
databaseMonths(5) = "jun"
databaseMonths(6) = "jul"
databaseMonths(7) = "aug"
databaseMonths(8) = "sep"
databaseMonths(9) = "oct"
databaseMonths(10) = "nov"
databaseMonths(11) = "dec"
databaseYear = MID(REQUEST("yr",3,2)
'---SET VARIABLES AND OPEN DATA FILE
dim thepath
thepath = server.mappath("/cms/FileLib/" & "\"
Response.ContentType="application/vnd.ms-excel"
set fso=Server.CreateObject("Scripting.FileSystemObject"
'SET playlistObject = Server.CreateObject("Scripting.FileSystemObject"
set file=fspenTextFile(thepath & databaseMonths(REQUEST("mo"-1) & databaseYear & ".txt"
'set file=fspenTextFile("D:\Inetpub\'SET playlist = playlistObject.OpenTextFile(thepath & databaseMonths(REQUEST("mo"-1) & databaseYear & ".txt"
size1=len(" 12:00 AM "
size2=len("PROGRAM "
size3=len("Parisian Quartet No. 10 (Nouveau No. 4)"
%>
<table border=1 CELLPADDING="1" CELLSPACING="1" BORDERCOLOR="#FFFFFF" BGCOLOR="#CCCCCC">
<%
function getLastNum(stext)
s=""
for i=len(stext) to 1 step -1
if mid(stext,i,1)<>" " then
s=s+mid(stext,i,1)
else
i=-1
end if
next
getLastNum=s
end function
while not file.AtEndOfStream
sline=file.ReadLine
if sline<>" " AND sline<>"" then
if instr(1,sline,"PLAY DATE:"=0 then
stime=left(sline,size1)
sline=replace(sline,stime,""
stype=left(sline,size2)
sline=replace(sline,stype,""
snumber=""
snumber=CStr(getNum(sline))
sline=replace(sline,snumber,""
slastnumber=getLastNum(sline)
sline=replace(sline,slastnumber,""
stitle=left(sline,size3)
sprod=replace(sline,stitle,""
if snumber<>"1.#QNAN" then
%>
<tr BORDERCOLOR="#FFFFFF">
<td><font size=2><%=stime%></font>
</td>
<td><font size=2><%=stype%></font>
</td>
<td><font size=2><%=snumber%></font>
</td>
<td><font size=2><%=stitle%></font>
</td>
<td><font size=2><pre><%=sprod%></pre></font>
</td>
<td><font size=2><pre><%=slastnumber%></pre></font>
</td>
</tr>
<%
end if
else
%>
<tr>
<td colspan=6 BORDERCOLOR="#FFFFFF"><font size=3><b><%=sline%></b></font>
</td>
</tr>
<%
end if
end if
wend
%>
</table>
<script language=javascript runat="server">
function getNum(str)
{
return parseInt(str)
}
</script>
<%
rsPLAYlist.Close()
Set rsPLAYlist = Nothing
%>
=============================================
This creates a excel wrkbok that I can manage to export a tab-delimited file into Access then use my limited experience in, <embarrassed> MM Dreamweaver to display the recordset by three session variables:
1) current time
2) current day
3) current month
I hate to go the well on this thread, but do you know how I could merge two Access tables by one criteria/variable? I mean, I have one table that contains the station programming information, and then I have this playlist file residing in another table. Is it possible to have a function build the program info in the table header then strip in the playlist info accordingly per which user queries?
For I would like to have the user to see what playing by those three criteria - this was gleaned from a survey.
More importantly - I would like to have the front page display the current composition, real-time, via a timer that queries the db for the current:
1) composition title
2) composer
3) program title/description
4) announcer bio
I have bitten off WAY more than I can chew. I would greatly appreciate any help you could offer.
I have parsed a whatever-delimited txt file this way. Thanks George for the the reply!
==============================================
<%
DIM databaseMonths(12)
databaseMonths(0) = "jan"
databaseMonths(1) = "feb"
databaseMonths(2) = "mar"
databaseMonths(3) = "apr"
databaseMonths(4) = "may"
databaseMonths(5) = "jun"
databaseMonths(6) = "jul"
databaseMonths(7) = "aug"
databaseMonths(8) = "sep"
databaseMonths(9) = "oct"
databaseMonths(10) = "nov"
databaseMonths(11) = "dec"
databaseYear = MID(REQUEST("yr",3,2)
'---SET VARIABLES AND OPEN DATA FILE
dim thepath
thepath = server.mappath("/cms/FileLib/" & "\"
Response.ContentType="application/vnd.ms-excel"
set fso=Server.CreateObject("Scripting.FileSystemObject"
'SET playlistObject = Server.CreateObject("Scripting.FileSystemObject"
set file=fspenTextFile(thepath & databaseMonths(REQUEST("mo"-1) & databaseYear & ".txt"
'set file=fspenTextFile("D:\Inetpub\'SET playlist = playlistObject.OpenTextFile(thepath & databaseMonths(REQUEST("mo"-1) & databaseYear & ".txt"
size1=len(" 12:00 AM "
size2=len("PROGRAM "
size3=len("Parisian Quartet No. 10 (Nouveau No. 4)"
%>
<table border=1 CELLPADDING="1" CELLSPACING="1" BORDERCOLOR="#FFFFFF" BGCOLOR="#CCCCCC">
<%
function getLastNum(stext)
s=""
for i=len(stext) to 1 step -1
if mid(stext,i,1)<>" " then
s=s+mid(stext,i,1)
else
i=-1
end if
next
getLastNum=s
end function
while not file.AtEndOfStream
sline=file.ReadLine
if sline<>" " AND sline<>"" then
if instr(1,sline,"PLAY DATE:"=0 then
stime=left(sline,size1)
sline=replace(sline,stime,""
stype=left(sline,size2)
sline=replace(sline,stype,""
snumber=""
snumber=CStr(getNum(sline))
sline=replace(sline,snumber,""
slastnumber=getLastNum(sline)
sline=replace(sline,slastnumber,""
stitle=left(sline,size3)
sprod=replace(sline,stitle,""
if snumber<>"1.#QNAN" then
%>
<tr BORDERCOLOR="#FFFFFF">
<td><font size=2><%=stime%></font>
</td>
<td><font size=2><%=stype%></font>
</td>
<td><font size=2><%=snumber%></font>
</td>
<td><font size=2><%=stitle%></font>
</td>
<td><font size=2><pre><%=sprod%></pre></font>
</td>
<td><font size=2><pre><%=slastnumber%></pre></font>
</td>
</tr>
<%
end if
else
%>
<tr>
<td colspan=6 BORDERCOLOR="#FFFFFF"><font size=3><b><%=sline%></b></font>
</td>
</tr>
<%
end if
end if
wend
%>
</table>
<script language=javascript runat="server">
function getNum(str)
{
return parseInt(str)
}
</script>
<%
rsPLAYlist.Close()
Set rsPLAYlist = Nothing
%>
=============================================
This creates a excel wrkbok that I can manage to export a tab-delimited file into Access then use my limited experience in, <embarrassed> MM Dreamweaver to display the recordset by three session variables:
1) current time
2) current day
3) current month
I hate to go the well on this thread, but do you know how I could merge two Access tables by one criteria/variable? I mean, I have one table that contains the station programming information, and then I have this playlist file residing in another table. Is it possible to have a function build the program info in the table header then strip in the playlist info accordingly per which user queries?
For I would like to have the user to see what playing by those three criteria - this was gleaned from a survey.
More importantly - I would like to have the front page display the current composition, real-time, via a timer that queries the db for the current:
1) composition title
2) composer
3) program title/description
4) announcer bio
I have bitten off WAY more than I can chew. I would greatly appreciate any help you could offer.