Milestones Professional ASP Example #3

This example uses Active Server Pages (ASP) to:
  
1     Open an existing Milestones Professional schedule from a web server.
2 Filter it using strings specified by the user through his browser
3 Once filtered, generate a bitmap and display in the user's browser
  

About using Milestones with ASP Scripts on your WebServer

Run one of our examples on our server

   
ASP CODE   (Milestones interface calls shown in Blue)
   
<%@Language=VBScript%>
<% Response.Expires = 0
Response.Buffer = TRUE
%>

<html>
<head>
<title>Milestones Professional ASP Filter Example</title>
</head>

<body bgcolor="#FFFFFF">

<P><IMG border=0 src="/images2000/prologo5.gif" ></P>
<P>&nbsp;</P>

<p><font face="Verdana" size="2">This example filters a schedule and displays the filtered schedule in the browser.</font>

<br>
<br>

<%
If Len(Request.Form("FormAction")) = 0 Then

' Show the initial schedule
set oMiles=GetObject("c:\miles2000\waterfall.ml6","Milestones")

oMiles.Activate

oMiles.Refresh

oMiles.SaveBitmap ("http://www.kidasa.com\information\programmers\asp\images\savefromvbscript.jpg")


oMiles.Close "NoSave"

%>

<p>Select a filter option from below:</p>

<!-- Start the form -->

<FORM METHOD="Post" ACTION="filtersample.asp" NAME="form1">
<INPUT TYPE=hidden NAME=FormAction Value=ShowAllTaskLines>
<p>
<INPUT TYPE=submit VALUE="Show All Task Lines">
</FORM>

<FORM METHOD="Post" ACTION="filtersample.asp" NAME="form2">
<INPUT TYPE=hidden NAME=FormAction Value=ShowLevelOneLines>
<p>
<INPUT TYPE=submit VALUE="Show Level 1 Task Lines">
</FORM>

<FORM METHOD="Post" ACTION="filtersample.asp" NAME="form12">
<INPUT TYPE=hidden NAME=FormAction Value=ShowLevelOneTwoLines>
<p>
<INPUT TYPE=submit VALUE="Show Level 1 and 2 Task Lines">
</FORM>

<FORM METHOD="Post" ACTION="filtersample.asp" NAME="form3">
<INPUT TYPE=hidden NAME=FormAction Value=ShowFilteredLines>
<p>
<INPUT TYPE=submit VALUE="Show Filtered Task Lines Containing (in first column)...">
<INPUT TYPE="text" ID="txtString1" NAME="txtString1">
<SELECT NAME="BOOLOP",SIZE="1">
<OPTION SELECTED VALUE="OR">OR</OPTION>
<OPTION VALUE="AND">AND</OPTION>
<OPTION VALUE="NOT">NOT</OPTION>
</SELECT>
<INPUT TYPE="text" ID="txtString2" NAME="txtString2">
</FORM>



<%
Response.Write "<p><img src=""/information/programmers/asp/images/savefromvbscript.jpg""></p>"

ElseIf Request.Form("FormAction") = "ShowAllTaskLines" Then

' Set filtering options and resave jpeg file
set oMiles=GetObject("c:\miles2000\waterfall.ml6","Milestones")

Randomize
ImageName = "filtout"+CStr(Rnd)+".jpg"
FullPathImageName = "http://www.kidasa.com\information\programmers\asp\images\"+ImageName
WWWPathImageName = "/information/programmers/asp/images/"+ImageName

oMiles.Activate
oMiles.Refresh
oMiles.SaveBitmap (FullPathImageName)
oMiles.Close "NoSave"

Response.Write "<p><img src="""+WWWPathImageName+"""></p>"

ElseIf Request.Form("FormAction") = "ShowLevelOneLines" Then

' Set filtering options and resave jpeg file
set oMiles=GetObject("c:\miles2000\waterfall.ml6","Milestones")

Randomize
ImageName = "filtout"+CStr(Rnd)+".jpg"
FullPathImageName = "http://www.kidasa.com\information\programmers\asp\images\"+ImageName
WWWPathImageName = "/information/programmers/asp/images/"+ImageName

oMiles.Activate
oMiles.Refresh
oMiles.RollUpTaskLines "1"
oMiles.SaveBitmap (FullPathImageName)
oMiles.Close "NoSave"

Response.Write "<p><img src="""+WWWPathImageName+"""></p>"

ElseIf Request.Form("FormAction") = "ShowLevelOneTwoLines" Then

' Set filtering options and resave jpeg file
set oMiles=GetObject("c:\miles2000\waterfall.ml6","Milestones")

Randomize
ImageName = "filtout"+CStr(Rnd)+".jpg"
FullPathImageName = "http://www.kidasa.com\information\programmers\asp\images\"+ImageName
WWWPathImageName = "/information/programmers/asp/images/"+ImageName

oMiles.Activate
oMiles.Refresh
oMiles.RollUpTaskLines "2"
oMiles.SaveBitmap (FullPathImageName)
oMiles.Close "NoSave"

Response.Write "<p><img src="""+WWWPathImageName+"""></p>"


ElseIf Request.Form("FormAction") = "ShowFilteredLines" Then

' Set filtering options and resave jpeg file

Dim txtString1
Dim txtString2
txtString1 = Request.Form("txtString1")
txtString2 = Request.Form("txtString2")

BoolType = Request.Form("BOOLOP")

set oMiles=GetObject("c:\miles2000\waterfall.ml6","Milestones")

Randomize
ImageName = "filtout"+CStr(Rnd)+".jpg"
FullPathImageName = "http://www.kidasa.com\information\programmers\asp\images\"+ImageName
WWWPathImageName = "/information/programmers/asp/images/"+ImageName

'Response.Write "<p>"+ImageName
'Response.Write "<p>"+FullPathImageName
'Response.Write "<p>"+WWWPathImageName

oMiles.Activate
oMiles.Refresh
oMiles.FilterTaskLines "1","AND",txtString1,CStr(BoolType),txtString2
oMiles.SaveBitmap (FullPathImageName)
oMiles.Close "NoSave"

Response.Write "<p><img src="""+WWWPathImageName+"""></p>"


End If
%>
<hr>

</body>
</html>

  

Click here to visit our main programmer's page.