Jump to content

Using JavaScript to interact with dropdown lists in WebFOCUS Designer - Assemble Visualizations.


David White 5

Recommended Posts

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-classes

Thanks in advance for any help!

David

Link to comment
Share on other sites

You can do this without JavaScript. It is accomplished with a feature called chaining. You can try this example:

-DEFAULT &REGION = '_FOC_NULL';-DEFAULT &ST = '_FOC_NULL';-DEFAULT &CITY = '_FOC_NULL'; TABLE FILE GGSALESSUM DOLLARS UNITSBY REGIONBY STBY CITYWHERE REGION EQ '&REGION.(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,$ENDSTYLEEND

The 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.

image.thumb.png.91f42fb52df50f1c58db48332b1d1ccc.png 

Link to comment
Share on other sites

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

  • 1 month later...

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 &REGION = '_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 '&REGION.(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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...