// Query for a report.
ReportID=String(Request.QueryString.Item ("ReportID"));
if (ReportID == "undefined" ) {
// No report was specified in the URL so select the first report in the database.
// Retrieve the SI_ID before selecting the whole report.
// SI_ID is indexed and faster to retrieve than the entire report.
try {
Result = IStore.Query
("Select SI_PROCESSINFO.SI_PROMPTS From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report'");
}
catch(e) {
Response.Write ("Example failed: try logging on first!<BR>");
}
// Retrieve the entire report using the ID.
Result = IStore.Query
("Select SI_PROCESSINFO.SI_PROMPTS From CI_INFOOBJECTS Where SI_ID = " + Result.Item(1).ID);
} else {
// Retrieve the report using the specified ID.
try {
Result = IStore.Query
("Select SI_PROCESSINFO.SI_PROMPTS From CI_INFOOBJECTS Where SI_ID = " + ReportID);
}
catch(e) {
Response.Write ("Example failed: try logging on first!<BR>");
}
}
// Retrieve the report.
ReportObject = Result.Item(1);
// Retrieve the report interface.
ReportInterface = ReportObject.PluginInterface("");
Response.Write ("<span class='tableHeading' >" + ReportObject.Title + "</span><BR>");
Response.Write ("To view the report choose values for the parameters below and click the view report button.<BR>");
Response.Write
("<FORM Name=ParamForm Action='ViewMultiReport.csp?NumParams="
+ ReportInterface.ReportParameters.Count
+ "&ReportID="
+ ReportObject.ID
+ "' Method=POST target= 'CART_REPORTS'"
+ " onsubmit=\"window.open('', 'CART_REPORTS', 'fullscreen=no,location=yes,scrollbars=no,menubars=yes,toolbars=yes,resizable=yes')\">");
if (ReportInterface.ReportParameters.Count > 0 ) {
// If there are parameters start listing them.
NumP = 0;
var reportPars = ReportInterface.ReportParameters;
for (i=1;i<=reportPars.Count;i++)
{
Response.Write ("<TR><TD>");
// Display the text that prompts the user to enter
// a value for the parameter.
NumP = NumP + 1;
// Contstruct the names of the controls.
Name = "Param" + NumP;
ListName = "List" + NumP;
param = reportPars.Item(i);
ParamName = param.ParameterName;
Pname = "Pname" + NumP;
// Retrieve the parameter's default values.
ParamValues = RetrieveValues(param);
switch (ParamName)
{
case "VendorName":
Response.Write ("<P><B>Choose the desired Vendor:</B><BR>" );
writeVendors(Name);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in Vendor list to make the list active and then start<BR>\");");
Response.Write("document.write(\"typing the Vendor name to sort down to desired Vendor and select that Vendor.<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
break;
case "BeginingOrganizationID":
Response.Write ("<P><B>Choose the desired Low Organization:</B><BR>" );
writeWMSOrgs(Name,Pname,ParamName);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in Oraganization list to make the list active and then start<BR>\");");
Response.Write("document.write(\"typing the Org Name to sort down to desired Starting Org and select that one - For Multiple picks use Cntrl-Click.<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
Response.Write("<input type='hidden' value=' " + Parray[i] + "'>");
break;
case "EndingOrganizationID":
Response.Write ("<P><B>Choose the desired High Organization:</B><BR>" );
writeWMSOrgs(Name,Pname,ParamName);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in Oraganization list to make the list active and then start<BR>\");");
Response.Write("document.write(\"typing the Org Name to sort down to desired Ending Org and select that one - For Multiple picks use Cntrl-Click.<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
Response.Write("<input type='hidden' value=' " + Parray[i] + "'>");
break;
case "FiscalYear":
Response.Write ("<P><B>Choose the desired Fiscal Year:</B><BR>" );
writeWMSFY(Name,Pname,ParamName);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in list to make it active and then start<BR>\");");
Response.Write("document.write(\"typing the FY Name to sort down to desired Year and select that one<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
Response.Write("<input type='hidden' value=' " + Parray[i] + "'>");
break;
case "EmpNbr":
Response.Write ("<P><B>Choose the desired Employee(s):</B><BR>" );
writeEmployees(Name,Pname,ParamName);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in Employee list to make the list active and then start<BR>\");");
Response.Write("document.write(\"typing the Employee name to sort down to desired Employee and select that Employee - For Multiple picks use Cntrl-Click.<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
Response.Write("<input type='hidden' value=' " + Parray[i] + "'>");
break;
case "WhatEmpNbr":
Response.Write ("<P><B>Choose the desired Employee(s):</B><BR>" );
writeEmployeesAFMS(Name,Pname,ParamName);
Response.Write("<script>");
Response.Write("if (navigator.appName.indexOf(\"Micro\")>=0) {");
Response.Write("document.write(\"Click any row in Employee list to make the list active and then start<BR>\");");
Response.Write("document.write(\"typing the Employee name to sort down to desired Employee and select that Employee - For Multiple picks use Cntrl-Click.<BR>\");");
Response.Write("document.write(\"Press the Escape key to reset search.<BR>\");");
Response.Write("}");
Response.Write("</script>");
Response.Write("<input type='hidden' value=' " + Parray[i] + "'>");
break;
[code]
[/color]
For example, if the parameter name is EmpNbr the above code calls the following:
[COLOR=green]
[code]
function writeEmployees(Name,pitem,pname)
{
if (myconn == null) {
connectToWhs();
}
SqlStrEmp = "Select trim(empl_nbr) enum,empl_nm from warehouse.hr_public order by empl_nm";
RS1 = myconn.Execute(SqlStrEmp);
Response.Write(" <table border=0 cellpadding=0 cellspacing=2 width=580>");
Response.Write(" <tr>");
Response.Write(" <td><SELECT NAME='" + Name + "' Size=10 MULTIPLE onkeypress='evalKey()'>");
while (! RS1.EOF)
{
empID= RS1("enum") ;
empName=RS1("empl_nm");
Response.Write("<OPTION VALUE='" + empID + "'>" + empName + "</OPTION>");
RS1.MoveNext();
}
Response.Write(" </SELECT></td>");
Response.Write("<script>");
Response.Write("document.ParamForm." + Name + ".selectedIndex=0;");
Response.Write("</script>");
Response.Write(" </tr>");
Response.Write("</table>");
Response.Write("<input type='hidden' name='" + pitem + "' value='" + pname +"'>")
Response.Write("<p></p>");
RS1.close;
myconn.close;
myconn=null;
}