ChooseDestination.csp


<%@ Language=JavaScript%>

<%

// This page allows a user to choose a report to schedule and a destination

// to send the instance to.  After the user has made a selection, DestinationOptions.csp

// is opened.

%>

<!-- #include file="RetrieveIStore.csp" -->

<!-- #include file=helper_js.csp -->


<html>

<body>

<%


function GetDestinations()

//This returns a list box populated with the desintations that are currently available

//in Crystal Enterprise.

{

    var Destinations = new Array();

    Destinations.push("FTP");

    Destinations.push("SMTP (Email)");

    Destinations.push("Unmanged Disk");

    Destinations.push("Printer");

    var HTML="<select name=Destination>";

    for (k=0;k<Destinations.length;k++)

    {

        HTML = HTML + "<option value='"+k+"'>"+Destinations[k]

    }

    HTML= HTML + "</select>";

    return HTML;

}    


function GetReports(IStore)

{

    // This function returns a listbox popuplated with all reports.

    //

    // RETURNS

    // If there are no reports, an empty string is returned.

    var Reports = IStore.Query("SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Report' And SI_INSTANCE=0");

    if (Reports.Count == 0)

    {    

        return "";

    }

    var k;

    var HTML="<select name=ReportId>";

    for (k=1;k<=Reports.Count;k++)

    {

        HTML = HTML + "<option value='"+Reports.Item(k).ID+"'>"+Reports.Item(k).Title;

    }

    HTML= HTML + "</select>";

    return HTML;

}




function Main()

/*

    Create a form that allows the user to choose a desintation and a report.

*/

{

    IStore = RetrieveIStore();

    if (IStore == null)

    {

        Response.Redirect ("Start.csp");

        return;

    }

    Response.Write ("<H2>Schedule a report send the instance to a particular destination</H2>");

    Response.Write ("<form action='DestinationOptions.csp' method=post name='Schedule'>");

    Response.Write ("Report: <BR>");

    Response.Write (GetReports(IStore));

    Response.Write ("<BR><BR>Format: <BR>");

    Response.Write (GetDestinations());

    Response.Write ("<BR><input type=submit name='Next' value='Next'>");

    Response.Write ("</FORM>");

}


Main();

%>

</body>

</html>





Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com