As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have a launch page that has three drop downs. One for customer code, one for item name and one for order number. When the user selects a customer code the part number drop down needs to be limited to only part numbers for that customer code.Whats the best way to make this happen? Here is my code
-SET &ECHO = 'ALL' ;
SET LINES = 998
SET EMPTYREPORT=ON
TABLE FILE RAS-AR_CUST_MST
SUM AR_CUST_CODE
BY AR_CUST_CODE NOPRINT
ON TABLE HOLD AS HOLDCUST
END
-RUN
DEFINE FILE HOLDCUST
CUSTALL/A100 = '<OPTION VALUE="'|AR_CUST_CODE|'">'|AR_CUST_CODE|'</OPTION>' ;
END
TABLE FILE HOLDCUST
PRINT CUSTALL
ON TABLE HOLD AS CUSTCODE FORMAT ALPHA
END
-RUN
TABLE FILE RAS-STK_TBL
SUM ITEM_NAME
BY ITEM_NAME NOPRINT
ON TABLE HOLD AS ALLOC1
END
-RUN
DEFINE FILE ALLOC1
OPT1/A100 = '<OPTION VALUE="'|ITEM_NAME|'">'|ITEM_NAME|'</OPTION>' ;
END
TABLE FILE ALLOC1
PRINT OPT1
ON TABLE HOLD AS ALLOCODE FORMAT ALPHA
END
-RUN
TABLE FILE RAS-SO_HDR_TBL
SUM SO_NO
BY SO_NO NOPRINT
ON TABLE HOLD AS ALLOC2
END
-RUN
DEFINE FILE ALLOC2
OPT/A100 = '<OPTION VALUE="'|SO_NO |'">'|SO_NO|'</OPTION>' ;
END
TABLE FILE ALLOC2
PRINT OPT
ON TABLE HOLD AS SOCODE FORMAT ALPHA
END
-RUN
-HTMLFORM BEGIN
<HTML>
<head>
<style>
.paramCol
{
FONT-SIZE: 11px;
FONT-WEIGHT: bold;
FONT-FAMILY: verdana, arial, helvetica, sans ;
TEXT-DECORATION: none
}
.paramVal
{
FONT-SIZE: 12px;
FONT-FAMILY: verdana, arial, helvetica, sans ;
TEXT-DECORATION: none
}
.subheadVal
{
FONT-SIZE: 12px;
FONT-WEIGHT: bold;
FONT-FAMILY: verdana, arial, helvetica, sans ;
TEXT-DECORATION: underline
}
</style>
</head>
<body style="BACKGROUND-color: #cccccc; OVERFLOW: auto">
<form name="form1" action="/ibi_apps/WFServlet?" method="post" >
<TABLE>
<tr><td align="center" colspan="4"> <font size="5">Sales Order Shipments</font> </td></tr>
<tr>
<td><select name="CUSTCODE">
<OPTION VALUE="ALL">All </OPTION>
!IBI.FIL.CUSTCODE;
</SELECT></TD>
<td><select name="ITEMNAME">
<OPTION VALUE="ALL">All </OPTION>
!IBI.FIL.ALLOCODE;
</SELECT></TD>
<td>Sales Order:</td>
<td> <select name="SONO" >
<option value="ALL"> All </option>
!IBI.FIL.SOCODE;
</select></td>
<table border="1" ><tr><td align="center" width="300" height="50" > Select Type of Display output<br>
<input type="radio" name="WFFMT" value="HTML" checked >
<img src="/approot/ras/htmllogo.gif" alt="Html" align="top" />
<font style="width:20px;"> </font>
<input type="radio" name="WFFMT" value="EXL2K" >
<img src="/approot/ras/exllogo.gif" alt="Html" align="top"/>
<font style="width:20px;"> </font>
<input type="radio" name="WFFMT" value="AHTML">
<img src="/approot/ras/ahtmlogo.gif" alt="Html" align="top" />
</td></tr>
</table>
</td></TR>
<tr><td></td><td><input type="submit" value="submit" style="BACKGROUND-COLOR: #00ff99" onclick="javascript:submitForm();return false;">
<font style="width:20px;"> </font>
<input type="submit" value="Export" style="BACKGROUND-COLOR: #00ff99" onclick="javascript:exportForm();return false;">
</td></tr>
</TABLE>
<input type="hidden" name="IBIF_webapp" value="/ibi_apps">
<input type="hidden" name="IBIC_server" value="EDASERVE">
<input type="hidden" name="IBIAPP_app" value="ras">
<input type="hidden" name="IBIF_ex" value="ras0011r0">
</form>
<IFRAME name="report1" id="report1" style="Z-INDEX: 1; LEFT: 0px; BACKGROUND-IMAGE: none; WIDTH: 215%; POSITION: absolute; TOP: 155px; HEIGHT: 720px" ></IFRAME>
</body>
</HTML>
-HTMLFORM END
This message has been edited. Last edited by: Kerry,
that might work but i would write my fexes to produce xml files -fex1 TABLE FILE THING SUM THINGNAME BY THINGCODE ON TABLE PCHOLD FORMAT XML END -fex2 TABLE FILE THING SUM 2ndNAME BY 2ndCODE IF THINGCODE IS &THINGCODE ON TABLE PCHOLD FORMAT XML END TABLE FILE THING SUM 3RDNAME BY 3RDCODE IF 2NDCODE IS &2NDCODE ON TABLE PCHOLD FORMAT XML END ..and load my 3 parameters i'm my launch page by clicking on Procedure for each of the parameters , rather than the master file name. and then chain them with the chain button. being sure to click them in the order you want, thingcode, 2ndcode, 3rdcode Its very touchy ... but this is how the manual says to do it. there's one thing that has to be set to 0 cacheruntimedata="0"This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
susannah, Donalds code has not been created in the layout tools.
Look at this I'm sure it was in adiscussion quite a while ago but I cannot find the link.
Basically it's three chained dropdowns that runs the report after selection of the last one.
-*
-* SET DEFAULT VALUES for required amper variables
-*
-DEFAULT &step=' '
-DEFAULT &COUNTRY='$*'
-DEFAULT &CAR='$*'
-DEFAULT &MODEL='$*'
-*
-* Check if your runnging the actual report of generating the dropdowns
-* and branch to the report if needed.
-*
-IF &step EQ 'runreport' GOTO runreport;
-*
SET HOLDLIST=PRINTONLY
SET PAGE=NOPAGE
-*
-* generate the first dropdown list as a standard option tag/value pair
-* save the output in ALPHA format
-*
DEFINE FILE CAR
OPT1/A100='<OPTION>' | COUNTRY || '</OPTION>';
END
TABLE FILE CAR
SUM
OPT1
BY
COUNTRY NOPRINT
ON TABLE SAVE AS CLIST1 FORMAT ALPHA
END
-RUN
-*
-* Generate the javascript code required for the 2nd dropdown
-* this is a two stage process. 1st extract the values sorted by the
-* value for the first dropdown and 2nd reformat the output using a define
-* to add the required Javascript syntax.
-* pay special attention to the labels and the subhead. The DF ('---- SELECT ----')
-* is very important for the onchange function used in the HTML
-* IMPORTANT save the output in WP format. This is required to ensure that the subhead and subfoot
-* is saved to the output file
-*
TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
FILEDEF CLIST2 DISK .\CLIST2.FTM
-RUN
DEFINE FILE HOLD1
DQ/A100='"' || COUNTRY || '"';
DF/A100='Select2.options[Select2.options.length] = new Option(' | '''' || '---- SELECT ----' || '''' || ');' ;
OPT2/A100='Select2.options[Select2.options.length] = new Option(' | '''' || CAR || '''' || ');' ;
END
TABLE FILE HOLD1
PRINT OPT2 AS ''
BY COUNTRY NOPRINT
BY CAR NOPRINT
ON COUNTRY SUBHEAD
"if (o == <DQ )"
"{"
"<DF"
ON COUNTRY SUBFOOT
"}"
ON TABLE HOLD AS CLIST2 FORMAT WP
END
-*
-* Generate the javascript code required for the 3rd dropdown
-* this is a two stage process. 1st extract the values sorted by the
-* value for the first dropdown and 2nd reformat the output using a define
-* to add the required Javascript syntax.
-* pay special attention to the labels and the subhead. The DF ('---- SELECT ----')
-* is very important for the onchange function used in the HTML
-* IMPORTANT save the output in WP format. This is required to ensure that the subhead and subfoot
-* is saved to the output file
-*
FILEDEF CLIST3 DISK .\CLIST3.FTM
-RUN
TABLE FILE CAR
PRINT MODEL
BY COUNTRY NOPRINT
BY CAR
ON TABLE HOLD AS HOLD2 FORMAT ALPHA
END
DEFINE FILE HOLD2
DQ/A100='"' || CAR || '"';
DF/A100='Select3.options[Select3.options.length] = new Option(' | '''' || '---- SELECT ----' || '''' || ');' ;
OPT3/A100='Select3.options[Select3.options.length] = new Option(' | '''' || MODEL || '''' || ');' ;
END
TABLEF FILE HOLD2
PRINT OPT3 AS ''
BY CAR NOPRINT
BY MODEL NOPRINT
ON CAR SUBHEAD
"if (o == <DQ )"
"{"
"<DF"
ON CAR SUBFOOT
"}"
ON TABLE SAVE AS CLIST3 FORMAT WP
END
-RUN
-*
-* create your selection menu as a WebFocus HTMLFORM
-*
-*
-runform
-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>Choose Model</TITLE>
-*
-* Script to run the report after the final selection
-*
<script language="JavaScript">
<!--
function getProds(whereto)
{
window.status = 'Working Please Wait';
form1.step.value = ""+whereto
document.form1.submit();
}
// -->
</script>
-*
-* Script which changes the windows message at the bottom of the Browser
-*
<script language="JavaScript">
function wStatus()
{
window.status = 'Screen Ready';
}
</script>
-*
-* Script for the 2nd dropdown box which is populated from the second extract at run time
-*
<script language="javascript">
function Select2Options(o)
{
var Select2 = document.form1.Select2;
Select2.options.length = 0;
!IBI.FIL.CLIST2;
}
</script>
-*
-* Script for the 3rd dropdown box which is populated from the second extract at run time
-* this script contains extra code to empty the 3rd dropdown if you change your selection
-* from the first dropdown
-*
<script language="javascript">
function Select3Options(o)
{
var Select3 = document.form1.Select3;
Select3.options.length = 0;
if (o == "NULL" )
{
Select3.options[Select3.options.length] = new Option(' ');
}
!IBI.FIL.CLIST3;
}
</script>
</HEAD>
<BODY onLoad="wStatus()">
<FORM NAME=form1 ACTION="/ibi_apps/WFServlet" METHOD="POST"
TARGET="_top">
<INPUT TYPE="hidden" NAME="IBIF_ex" VALUE="javascript_dynamic_dropdowns.fex">
<INPUT TYPE="hidden" NAME="step" VALUE="STEP_4">
<P><H4><I><font color="6A5ACD">Select Country:</font></I></H4>
-*
-* The 1st dropdown the onchange action runs the 2nd dropdown script and populates the 2nd dropdown box
-* it also runs the 3rd dropdown script and resets the 3rd dropdown box so that it is empty
-*
<SELECT WIDTH="300" STYLE="width: 200px" NAME="COUNTRY" onchange="Select2Options(document.form1.COUNTRY.options[document.form1.COUNTRY.selectedIndex].text);Select3Options('NULL');">
<OPTION VALUE='$*'>---- SELECT ----
!IBI.FIL.CLIST1;
</SELECT><BR>
-*
-* The 2nd dropdown this is populated by the action of the 1st dropdown
-* The onchange action runs the 3rd dropdown script and populates the 3rd dropdown box
-*
<H4><I><font color="6A5ACD"> Select Car:</font></I></H4>
<SELECT WIDTH="300" STYLE="width: 200px" NAME="Select2" onchange="Select3Options(document.form1.Select2.options[document.form1.Select2.selectedIndex].text);">
<OPTION VALUE='$*'>
</SELECT><BR><BR>
-*
-* The 3rd dropdown box his is populated by the action of the 2nd dropdown or reset if the 1st dropdown is changed
-* The onchange action runs the final report by calling IBI_ex and passing it the parameter needed to bypass the script
-* processing and branch to the actual report code
-*
<H4><I><font color="6A5ACD"> Select Model:</font></I></H4>
<SELECT WIDTH="300" STYLE="width: 200px" NAME="Select3" onChange="getProds('runreport');">
<OPTION VALUE='$*'>
</SELECT><BR><BR>
<BR><BR>
</FORM>
</BODY>
</HTML>
-HTMLFORM END
-EXIT
-*
-runreport
-*
-* run the report
-* YOUR REPORT CODE FOLLOWS
-*
TABLE FILE CAR
PRINT COUNTRY CAR MODEL DEALER_COST RETAIL_COST
WHERE COUNTRY EQ '&COUNTRY'
WHERE CAR EQ '&Select2'
WHERE MODEL EQ '&Select3'
END
As your code is a single fex and publishes your HTML page itself, I would utilise the code to do all that for you depending upon how long it takes to render from scratch. If it is fairly quick then I would use the original technique from the early days of WebFOCUS when AJAX was unheard of.
As I say, the idea is an old one, but can be found elsewhere on this forum (a search on "chained combo" should give you plenty to look through). Essentially you DEFAULT all the variables and then within each subsequent build of select control items you include a selection on the limiting variable. We used to use $* to indicate a "select all" situation but we now utilise the "FOC_NONE" value to achieve a similar result. Using this your code would look something like this -
-DEFAULT CUSTCODE = 'FOC_NONE'
-DEFAULT ITEMNAME = 'FOC_NONE'
-DEFAULT SONO = 'FOC_NONE'
-* First combo box contents
TABLE FILE RAS-AR_CUST_MST
SUM AR_CUST_CODE
BY AR_CUST_CODE NOPRINT
ON TABLE HOLD AS HOLDCUST
END
-RUN
DEFINE FILE HOLDCUST
CUSTALL/A100 = '<OPTION VALUE="'|AR_CUST_CODE|'">'|AR_CUST_CODE|'</OPTION>' ;
END
TABLE FILE HOLDCUST
PRINT CUSTALL
ON TABLE HOLD AS CUSTCODE FORMAT ALPHA
END
-RUN
-* Second combo box contents
TABLE FILE RAS-STK_TBL
SUM ITEM_NAME
BY ITEM_NAME NOPRINT
WHERE custcode_field EQ '&CUSTCODE'
ON TABLE HOLD AS ALLOC1
END
-RUN
DEFINE FILE ALLOC1
OPT1/A100 = '<OPTION VALUE="'|ITEM_NAME|'">'|ITEM_NAME|'</OPTION>' ;
END
TABLE FILE ALLOC1
PRINT OPT1
ON TABLE HOLD AS ALLOCODE FORMAT ALPHA
END
-RUN
-* Third combo box contents
TABLE FILE RAS-SO_HDR_TBL
SUM SO_NO
BY SO_NO NOPRINT
WHERE custcode_field EQ '&CUSTCODE'
WHERE itemname_field EQ '&ITEMNAME'
ON TABLE HOLD AS ALLOC2
END
-RUN
DEFINE FILE ALLOC2
OPT/A100 = '<OPTION VALUE="'|SO_NO |'">'|SO_NO|'</OPTION>' ;
END
TABLE FILE ALLOC2
PRINT OPT
ON TABLE HOLD AS SOCODE FORMAT ALPHA
END
-RUN
-HTMLFORM BEGIN
You would need to add an onchange event to submit the form and rerun your code and that is why I say this technique depends upon the speed of initial render. If it takes a long time then I would resort to building your page as a separate HTML file and do as Susannah suggests and utilise the supplied javascript files (linked into your html page by painter) and chain the combo boxes. This uses AJAX and requires that the output from the fex is in XML format with two columns - some of the topics from the search above will help you more.
Good luck
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004