Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Populating drop down list based on value from another

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Populating drop down list based on value from another
 Login/Join
 
Gold member
posted
Has anyone done the following -- we are using WF 5.3 -- populate a drop down list depending on
the value of another drop down list. For example, using the CAR table, I could select one country from a drop down list and depending on which country I selected another drop down list would display the models associated to that country. I would like all this done within one window.
Thanks
 
Posts: 69 | Location: OH | Registered: November 09, 2004Report This Post
Platinum Member
posted Hide Post
There is a method if you know the list which has to be populated in the second for any selection of the first.
Based on the selection on the first list populate the second using javascript.

function LoadList(text) {
var optionName = new Option(text, text, false, false)
var length = whatTo.length;
whatTo.options[length] = optionName;
}
 
Posts: 143 | Location: Rochester,NY. | Registered: August 20, 2004Report This Post
Platinum Member
posted Hide Post
It's called chaining. You can do this in Resource Layout. Select the two dropdown boxes and chain them together using the dynamic chain button at the bottom of the screen ( a couple of chain links with a PLUS sign).

That'll do it.

Ken
 
Posts: 177 | Location: Calgary, Alberta, Canada | Registered: April 25, 2005Report This Post
Expert
posted Hide Post
the only drawback to using js arrays is that you can't select a variable from the 2nd list..first.
you're imposing an order.
Cyril..is this correct? or is there a way around that?
tia.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Guru
posted Hide Post
I have done something similar, where you can select from the boxes in any order, and have the others re-written. I have trimmed out all but 3 drop-down boxes from this example. It uses focus code to re-write the drop-down lists because my js ability is very poor. You can only pick "ALL" or one option from each box and have it work. Also I didn't know how to code the "Reset" button. In the real code the drop-down lists are not generated from the "CAR" or any other permanent file, but a hold files that contain all valid combinations which are only created 1x per job, to speed up processing (a lot)

-* Only run first portion if this is the first time or reset.
-DEFAULT &XTIME=0;
-IF &XTIME NE 0 GOTO SKIPFIRST;
-*Create the hold files for the drop-down possibilities here. (excluded from this code)
-DEFAULT &LOB='ALL'
-DEFAULT &COUNTRY='ALL'
-DEFAULT &STATE='ALL'
-SKIPFIRST
-SET &XTIME=&XTIME + 1;
-* Set up files for drop-down boxes
FILEDEF LOBLIST DISK &TEMPPATH|loblist.txt
FILEDEF CNTYLIST DISK &TEMPPATH|cntylist.txt
FILEDEF STLIST DISK &TEMPPATH|stlist.txt
-RUN
-*Write the "ALL" option for all drop-down boxes, or one selected value if already selected
-WRITE LOBLIST
-WRITE CNTYLIST
-WRITE STLIST
FILEDEF LOBLIST DISK &TEMPPATH|loblist.txt (APPEND
FILEDEF CNTYLIST DISK &TEMPPATH|cntylist.txt (APPEND
FILEDEF STLIST DISK &TEMPPATH|stlist.txt (APPEND
-RUN

DEFINE FILE CAR
LOBOPTION/A120 = '';
CNTYOPTION/A120='';
STOPTION/A120='';
-* Get values for Location drop-down boxes if not already selected
-IF &LOB NE 'ALL' GOTO SKIPA1;
TABLE FILE CAR
ON TABLE SET HOLDLIST PRINTONLY
SUM LOBOPTION
BY LINE_OF_BUS_CD NOPRINT
-IF &COUNTRY EQ 'ALL' GOTO SKIPB1;
WHERE COUNTRY_DESC EQ '&COUNTRY'
-SKIPB1
-IF &STATE EQ 'ALL' GOTO SKIPC1;
WHERE STATE EQ '&STATE'
-SKIPC1
WHERE LINE_OF_BUS_DESC NE ''
ON TABLE HOLD AS LOBLIST FORMAT ALPHA
END
-SKIPA1

-IF &COUNTRY NE 'ALL' GOTO SKIPB2;
TABLE FILE LOCATION
ON TABLE SET HOLDLIST PRINTONLY
SUM CNTYOPTION
BY COUNTRY_DESC NOPRINT
-IF &LOB EQ 'ALL' GOTO SKIPA2;
WHERE LINE_OF_BUS_DESC EQ '&LOB'
-SKIPA2
-IF &STATE EQ 'ALL' GOTO SKIPC2;
WHERE STATE EQ '&STATE'
-SKIPC2
WHERE COUNTRY_DESC NE ''
ON TABLE HOLD AS CNTYLIST FORMAT ALPHA
END
-SKIPB2

-IF &STATE NE 'ALL' GOTO SKIPC3;
TABLE FILE LOCATION
ON TABLE SET HOLDLIST PRINTONLY
SUM STOPTION
BY STATE NOPRINT
-IF &LOB EQ 'ALL' GOTO SKIPA3;
WHERE LINE_OF_BUS_DESC EQ '&LOB'
-SKIPA3
-IF &COUNTRY EQ 'ALL' GOTO SKIPB3;
WHERE COUNTRY_DESC EQ '&COUNTRY'
-SKIPB3
WHERE STATE NE ''
ON TABLE HOLD AS STLIST FORMAT ALPHA
END
-SKIPC3

-HTMLFORM BEGIN


Eligibility
























Eligibility


Pick selections and then click Submit




Line of Business:



Country:



State:











Output Type:

PDF

Excel

HTML




To reset,
use the back button
on your browser.




-HTMLFORM END

This message has been edited. Last edited by: <Maryellen>,


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
applause, Nicola. that is very nice work.
nice use of the onchange command.
that's more usable than the javascriptarray method, i think, less restrictive to the user.
javascript array would be easier to hardcode, but harder to write fex to create in batch as a server-side include.
thanks very much for sharing. I hope you've considered submitting as a speaker at summit next year.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Guru
posted Hide Post
I'm pretty sure someone has posted that use of onChange command here before. Like I said, my js coding is not that good, I'd have to have gotten it from somewhere.
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Populating drop down list based on value from another

Copyright © 1996-2020 Information Builders