Hmm... you must be gluttons for punishment if you want to see my code...
Here's one of my less convoluted examples. I just hope this doesn't get truncated.
Part one: This is the bit that sits in the users' domain, sets up context and invokes a launch page...
-*************************************
-SET &ECHO='ALL';
-MRNOEDIT -INCLUDE baseapp/getuserinfo.fex
-INCLUDE app/setshortdept.fex
-SET &DIV='All';
-INCLUDE u8u1byjb/app/labor_distribution_exception_report_by_person.fex
-*************************************
Part two: This is the -INCLUDEd launch page with a little dynamic content. It's just an edited "published" page with some ampers added. As you can see this one is a combo of the WF-made javascript prompting and my own.
-*************************************
-MRNOEDIT -INCLUDE baseapp/getuserinfo.fex
-INCLUDE app/setshortdept.fex
-SET &DEPT=IF '&DEPT.EVAL' EQ 'MEDICINE' THEN 'Internal Medicine' ELSE '&DEPT.EVAL';
-SET &DIVTTL=IF '&DIV.EVAL' = 'All' THEN '' ELSE 'Division: &DIV.EVAL';
-MRNOEDIT -INCLUDE baseapp/fmnthname.fex
-SET &FMNTHNAME=&FMNTHNAME.&USRMNTH;
ENGINE SQLMSS SET DEFAULT_CONNECTION CON01
SQL SQLMSS
-MRNOEDIT EX expenditures.dbo.selectdistinctdivisions '&DEPT';
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS SQLOUT
END
-RUN
TABLE FILE SQLOUT
SUM
COMPUTE DV/A99= '<OPTION VALUE="'|Division|'">'|Division|'</OPTION>';
BY Division NOPRINT
ON TABLE HOLD AS DIVLIST FORMAT ALPHA
END
-*? &
-*EXIT
-HTMLFORM BEGIN
<HTML>
<HEAD><CENTER><FONT SIZE=+2></FONT>
<TITLE>Labor Distribution Exception Report Month By Person</TITLE>
<script src="/ibi_html/javaassist/cgipath.js"></script>
<script language="javascript">
function init()
{
//updated for Release 5
document.form.action = getWFScriptName();
if ((document.form.IBIMR_defer != null) &|&|
(document.form.IBIMR_threebuttons != null))
document.form.IBIMR_defer.value="";
}
</script>
</HEAD>
<BODY BACKGROUND='/ibi_html/template/none_bkg.gif' onLoad="javascript:init();">
<H2>Labor Distribution Exception Report<p>Month By Person<p>For &DEPTNAME.EVAL<p>&DIVTTL.EVAL</H2>
<CENTER><P><FONT SIZE=+1></FONT></CENTER>
<FORM name='form' action='/ibi_apps/WFServlet' method='post' onSubmit='return PostWFForm(this);'>
-*IF '&DIV.EVAL' NE 'All' GOTO NOTALL;
Choose a Division or &DEPTNAME.EVAL<BR>
<SELECT NAME = "DIV" MULTIPLE SIZE=10>
<OPTION VALUE="All">&DEPTNAME.EVAL</OPTION>
-IF '&DIV.EVAL' NE 'All' THEN GOTO ONEDIV;
!IBI.FIL.DIVLIST;
-GOTO DONEDIV;
-ONEDIV
<OPTION VALUE="&DIV.EVAL">&DIV.EVAL</OPTION>
-DONEDIV
</SELECT>
-NOTALL
<TABLE>
<!-- Created by WebFOCUS -->
<!--Created with $Revision: 1.3 $: of publish.xsl-->
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript">
var ibiOptions = new Array("ibihttpxml","mntFormValidate","olap","olappanebase","olapdrill","ibilangtrans");
var debugDescription = false;
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript" src="/ibi_html/javaassist/ibi/html/describe/APPrintData.js">
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript" src="/ibi_html/javaassist/ibi/html/describe/APAutoprompt.js">
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript" src="/ibi_html/javaassist/ibi/html/describe/APHTMLGen.js">
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript" src="/ibi_html/javaassist/nls.js">
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript" src="/ibi_html/javaassist/ibi/html/js/ibigbl.js">
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" type="text/javascript">addIntlTranslatedJS("autoprompttrans.js");
</script>
<script xmlns="http://www.w3.org/TR/xhtml1/strict" language="javascript">
var jsData = new Object( );
function InitData( )
{
var i = 0;
var j = 0;
var strTmp;
jsData.heading = "";
jsData.newLineEscape = "0xD;0xA;";
jsData.bindingInfo = new Array( );
//ETC...
//Deleted all JS stuff for brevity.
//===========================================================
jsData.ampers[i] = new Object( );
//jsData.ampers[i].inForm = 0;
jsData.ampers[i].name = "FLTR";
jsData.ampers[i].fieldName = jsData.ampers[i].name;// "Field" + i;
jsData.ampers[i].type = "prompt";
if( jsData.ampers[i].type == "unresolved" || jsData.ampers[i].type == "default" || jsData.ampers[i].type == "prompt" )
jsData.ampers[i].inForm = 1;
else
jsData.ampers[i].inForm = 0;
jsData.ampers[i].format = "";
jsData.ampers[i].min = "";
jsData.ampers[i].max = "";
jsData.ampers[i].strDef = '';
jsData.ampers[i].desc = "Show";
jsData.ampers[i].disType = "static";
j = 0;
jsData.ampers[i].values = new Array( );
jsData.ampers[i].display = new Array( );
if(jsData.ampers[i].operation != null){
jsData.ampers[i].values[j] = "FOC_ALL";
jsData.ampers[i].display[j] = "Select All";
j++;
}
jsData.ampers[i].values[j] = "All";
jsData.ampers[i].display[j] = "Everyone";
j++;
jsData.ampers[i].values[j] = "Exceptions";
jsData.ampers[i].display[j] = "Exceptions Only";
j++;
i++;
jsData.isSaveParam = IsSavedParameters( );
var strURL_PROTOCOL = GetBindingInfoValue( "URL_PROTOCOL" );
var strSERVER_NAME = GetBindingInfoValue( "SERVER_NAME" );
var strSERVER_PORT = GetBindingInfoValue( "SERVER_PORT" );
var strSCRIPT_NAME = GetBindingInfoValue( "SCRIPT_NAME" );
//jsData.formAction = strURL_PROTOCOL + "://" + strSERVER_NAME + ":" + strSERVER_PORT + strSCRIPT_NAME;
jsData.formAction = strSCRIPT_NAME; //[140719] sap portal fix
var strIBIC_server = GetBindingInfoValue( "IBIC_server" );
var strIBIAPP_app = GetBindingInfoValue( "IBIAPP_app" );
for( i = 0; i < jsData.ampers.length; i++ )
if( jsData.ampers[i].dynValues )
getDynamicValues( jsData.formAction, jsData.ampers[i], strIBIC_server, strIBIAPP_app );
//PrintData( jsData );
}
InitData( );
//===================================================================
function PostWFForm(form)
{
SetMultiSelectFields( document.form, false );
/* DON'T DO THIS FOR NOW. JUST SEND EMPTY VALUES
// ENSURE THAT ALL OPTIONS ARE FILLED BEFORE WE POST
var formLen = form.elements.length;
for( var i = 0; i < formLen; ++i )
{
if( form.elements[i].disabled == false )
{
if( form.elements[i].type == "text"
|| form.elements[i].type == "select-one"
|| form.elements[i].type == "select-multiple" )
{
if( debugDescription )
debugWindowLine( " Name:",form.elements[i].name," Type:",form.elements[i].type," Length:",form.elements[i].value.length );
if( form.elements[i].value.length == 0 )
{
form.elements[i].focus();
return false;
}
}
}
}
*/
return true;
}
//===================================================================
function onLoadDescribeForm( )
{
mntFormValidateOnloadFunc( );
for( var i = 0; i < jsData.ampers.length; i++ )
{
if( jsData.ampers[i].inForm == 1 )
{
if( jsData.ampers[i].operation &|&| jsData.ampers[i].operation != "" )
document.form[jsData.ampers[i].fieldName+"_MULTI"].focus( );
else
document.form[jsData.ampers[i].fieldName].focus( );
break;
}
}
}
</script>
<table xmlns="http://www.w3.org/TR/xhtml1/strict">
<script language="javascript">
{
var strPrefix = '<tr>' + '<td noibitranslate="yes">';
var strSeparator = '</td>' + '<td noibitranslate="yes">:' + '</td>' + '<td noibitranslate="yes">';
var strSuffix = '</td>' + '</tr>';
WriteInputFields( strPrefix, strSeparator, strSuffix );
}
</script>
</table>
<INPUT TYPE='hidden' name='DEPT' value='&DEPT.EVAL'>
<INPUT TYPE='hidden' name='DIV' value='&DIV.EVAL'>
<INPUT TYPE='hidden' name='IBIMR_domain' value='labordis/labordis.htm'>
<INPUT TYPE='hidden' name='IBIMR_action' value='MR_RUN_FEX'>
<INPUT TYPE='hidden' name='IBIMR_sub_action' value='MR_STD_REPORT'>
<INPUT TYPE='hidden' name='IBIMR_fex' value='app/intx87n5.fex'>
<INPUT TYPE='hidden' name='IBIF_ex' value='app/intx87n5.fex'>
<INPUT TYPE='hidden' name='IBIMR_flags' value=''>
<INPUT TYPE='hidden' name='IBIMR_folder' value='#ldeq6hmkyall'>
<input type='hidden' name='IBIMR_random' value=''>
<script>
document.form.IBIMR_random.value = Math.random();
</script>
<tr><td><INPUT TYPE='submit' NAME='Submit' VALUE='Submit'></td></tr>
<tr><td>
<script language="JavaScript">
function onSubmdefer()
{
document.form.IBIMR_defer.value="Defer";
document.form.submit();
}
</script>
<INPUT TYPE='button' NAME='Submit' VALUE='Defer' onClick="javascript:onSubmdefer();return false;">
<input type='hidden' name='IBIMR_defer' value='RUN'>
</td></tr><INPUT TYPE='hidden' name='IBIMR_threebuttons' value='true'>
<tr><td>
<INPUT TYPE='RESET' NAME='reset' VALUE='Reset'>
</td></tr>
</TABLE>
</FORM>
</BODY>
</HTML>
-HTMLFORM END
-*************************************
Next we have the report generator itself, invoked by the launcher which passes it all the ampervars it needs for context.
-*************************************
-SET &ECHO='ALL';
-SET &END_MONTH = IF &BEGIN_MONTH.EVAL EQ 12 THEN 1 ELSE &BEGIN_MONTH + 1;
-SET &END_YEAR = IF &BEGIN_MONTH.EVAL EQ 12 THEN &BEGIN_YEAR + 1 ELSE &BEGIN_YEAR;
-SET &BEGIN_DATE='&BEGIN_YEAR.EVAL/&BEGIN_MONTH.EVAL/25';
-SET &END_DATE = '&END_YEAR.EVAL/&END_MONTH.EVAL/24';
ENGINE SQLMSS SET DEFAULT_CONNECTION CON01
SQL SQLMSS
-MRNOEDIT EX expenditures.dbo.activelaborschedulesnew '&BEGIN_DATE', '&END_DATE', '&DEPT', '&DIV.EVAL', '0';
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS SQLOUT
END
-RUN
-IF &LINES EQ 0 THEN GOTO NODATA;
DEFINE FILE SQLOUT
UBD/YYMD='&BEGIN_DATE';
UED/YYMD='&END_DATE';
TP/I4=TotPercent;
SBD/YYMD=HDATE(SCHEDULE_BEGIN_DATE, 'YYMD');
SED/YYMD=HDATE(SCHEDULE_END_DATE, 'YYMD');
PBD/YYMD=HDATE(PROJECT_START_DATE, 'YYMD');
PED/YYMD=HDATE(PROJECT_END_DATE, 'YYMD');
ABD/YYMD=HDATE(AWARD_START_DATE, 'YYMD');
AED/YYMD=HDATE(AWARD_END_DATE, 'YYMD');
END
TABLE FILE SQLOUT
PRINT
UBD NOPRINT
UED NOPRINT
ASSIGNMENT_NUMBER AS 'Assignment Num'
SBD AS 'Sched,Begin'
SED AS 'Sched,End'
CalculatedPercent AS 'Calc,Sched %'
EXPENDITURE_TYPE AS 'Exp,Type'
PROJECT_NUMBER AS 'Proj Num'
PBD AS 'Proj,Start'
PED AS 'Proj,End'
AWARD_NUMBER AS 'Award Num'
ABD AS 'Award,Start'
AED AS 'Award,End'
BY EMP_ORGANIZATION_NAME NOPRINT
BY EMPLOYEE_NAME NOPRINT
BY ASSIGNMENT_NUMBER NOPRINT
BY SCHEDULE_BEGIN_DATE NOPRINT
ON EMPLOYEE_NAME SUBTOTAL AS 'Total Schedule Percentage for '
ON EMPLOYEE_NAME PAGE-BREAK
ON ASSIGNMENT_NUMBER SUBTOTAL AS 'Total Schedule Percentage for '
-IF '&FLTR.EVAL' EQ 'All' GOTO SHOWALL;
WHERE ((PullFlag EQ '1') OR (TotPercent LT '99.5' OR TotPercent GT '100.5')) ;
-SHOWALL
HEADING
"Labor Distribution Exception Report for <EMPLOYEE_NAME"
"<EMP_ORGANIZATION_NAME"
"Period: <UBD through <UED"
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT &OUTFMT.EVAL
ON TABLE SET HTMLCSS ON
-SET &BK='BACKCOLOR=RGB(210 210 210),';
-SET &REM=IF '&OUTFMT.EVAL' EQ 'PDF' THEN 'BACKCOLOR=RGB(255 255 255),' ELSE '&BK.EVAL';
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE, PAGESIZE=LEGAL, BOTTOMMARGIN=0, TOPMARGIN=0, LEFTMARGIN=.75, RIGHTMARGIN=0,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=SUBTOTAL,
BY=2,
COLOR='RED',
STYLE=BOLD,
WHEN = CalculatedPercent LE 99,
$
TYPE=SUBTOTAL,
BY=3,
COLOR='RED',
STYLE=BOLD,
WHEN = CalculatedPercent LE 99,
$
TYPE=SUBTOTAL,
BY=2,
COLOR='RED',
STYLE=BOLD,
WHEN = CalculatedPercent GE 101,
$
TYPE=SUBTOTAL,
BY=3,
COLOR='RED',
STYLE=BOLD,
WHEN = CalculatedPercent GE 101,
$
TYPE=DATA,
COLUMN=P1,
JUSTIFY=RIGHT,
$
TYPE=TITLE,
COLUMN=P1,
JUSTIFY=RIGHT,
$
TYPE=DATA,
COLUMN=PBD,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=PBD GT UBD,
$
TYPE=DATA,
COLUMN=PED,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=PED LT UED,
$
TYPE=DATA,
COLUMN=ABD,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=ABD GT UBD,
$
TYPE=DATA,
COLUMN=AED,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=AED LT UED,
$
TYPE=DATA,
COLUMN=SBD,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=SBD GT UBD,
$
TYPE=DATA,
COLUMN=SED,
BACKCOLOR='RED',
STYLE=BOLD,
WHEN=SED LT UED,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=HEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBTOTAL,
$&BK.EVAL
$
TYPE=ACROSSVALUE,
SIZE=9,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
&BK.EVAL
STYLE=BOLD,
$
ENDSTYLE
END
-EXIT
-? &
-NODATA
-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>Zero records returned
</TITLE>
</HEAD>
<BODY>
<H2>
LD Exception Report
</H2>
You have received no data for your report request. Please email the ERP help desk and someone will get right back to you about this issue.
Thank you,
The ERP Development Team
<HR>
activelaborschedulesnew '&BEGIN_DATE', '&END_DATE', '&DEPT', '&DIV.EVAL', '0';
</BODY>
</HTML>
-HTMLFORM END
-EXIT
-*************************************
Live and Direct from the University of Virginia.
DevStudio 7.6.9 - WF-7.6.9 - Win2k3 - MRE - RC - MSSQL - XBOX-360 Elite - Playstation 3 - Wii - PSP - Nintendo DSi - iPod Touch - Suzuki B-King - Honda Valkyrie - Subaru WRX STI - Canon EOS 1D Mark IV - Lover of Toys.