David White 5 Posted December 27, 2023 Share Posted December 27, 2023 Hello,Does anyone happen to have a simple working example of using JavaScript to dynamically populate a second dropdown list based on the selection in the first?The examples I've seen in the documentation don't access dropdown lists as far as I've seen:-https://kb.informationbuilders.com/topic/applying-custom-javascript-page -https://kb.informationbuilders.com/topic/designer-javascript-api-classesThanks in advance for any help!David Link to comment Share on other sites More sharing options...
David Beagan Posted December 28, 2023 Share Posted December 28, 2023 You can do this without JavaScript. It is accomplished with a feature called chaining. You can try this example:-DEFAULT ®ION = '_FOC_NULL';-DEFAULT &ST = '_FOC_NULL';-DEFAULT &CITY = '_FOC_NULL'; TABLE FILE GGSALESSUM DOLLARS UNITSBY REGIONBY STBY CITYWHERE REGION EQ '®ION.(FIND REGION IN GGSALES|FORMAT=A11).' AND ST EQ '&ST.(FIND ST IN GGSALES|FORMAT=A2,WITHIN=REGION).' AND CITY EQ '&CITY.(FIND CITY IN GGSALES|FORMAT=A20,WITHIN=ST).';ON TABLE SET PAGE-NUM NOLEADON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,$ENDSTYLEENDThe important part is the the WITHIN keyword in the extended definition of the variables.When the above code is saved in a fex and used in Designer, you can select a REGION then see only the ST for that REGION, etc. Link to comment Share on other sites More sharing options...
David White 5 Posted December 28, 2023 Author Share Posted December 28, 2023 Hi David,Unfortunately, the data I'm working with is not hierarchical, so I would still love to see a JavaScript example if someone has one.That said, in most cases the data will be hierarchical, so I will look to implement the technique you shared in those scenarios... thank you!David Link to comment Share on other sites More sharing options...
David Beagan Posted February 12 Share Posted February 12 In importing this answer over from the TIBCO Community all of the line breaks got stripped off. Here is the code with the line breaks. -DEFAULT ®ION = '_FOC_NULL'; -DEFAULT &ST = '_FOC_NULL'; -DEFAULT &CITY = '_FOC_NULL'; TABLE FILE GGSALES SUM DOLLARS UNITS BY REGION BY ST BY CITY WHERE REGION EQ '®ION.(FIND REGION IN GGSALES|FORMAT=A11).' AND ST EQ '&ST.(FIND ST IN GGSALES|FORMAT=A2,WITHIN=REGION).' AND CITY EQ '&CITY.(FIND CITY IN GGSALES|FORMAT=A20,WITHIN=ST).'; ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,$ ENDSTYLE END Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now