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     Building dynamic drop-down boxes/ALL option

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Building dynamic drop-down boxes/ALL option
 Login/Join
 
Platinum Member
posted
I'm trying to learn how to do dynamic drop-down boxes. I may be way off track if so I welcome any advice to re-FOCUS. Wink

I want an "ALL" option in my drop-down - How do I get it there ?

The following code will create a dynamic list from my table but I need to know how to get "ALL" in it or some other way to allow for a select "ALL".

Thanks
V

version 4.3.6/no developers studio/using MRE and Notepad HTML

FILEDEF CRSLST DISK BAIS.HTM

DEFINE FILE BU01TB10
OPTBUDGETAREA/A30= '<OPTION>' | CD_BDGT_AREA ;
END
TABLE FILE BU01TB10
ON TABLE SET PAGE-NUM OFF
SUM OPTBUDGETAREA
BY CD_BDGT_AREA NOPRINT
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE

ON TABLE HOLD AS BAIS FORMAT ALPHA
END

-HTMLFORM BAP1
 
Posts: 132 | Location: Kansas | Registered: November 12, 2003Report This Post
<mhuber>
posted
At the risk of sounding sarcastic...
If you want your users to be able to select "ALL", then just allow them to!
You can make "ALL" an option, and take care of the logic in Dialogue Manager. Based on the code you posted, it seems that you can easily add <OPTION>ALL to the top of the drop-down box.

In my environment, we're only using textboxes for parameters, but we wanted to be able to report over all values. These two lines of DM allowed us to do that (as you may have guessed, these are all single-quotes, aka apostrophes):
-DEFAULT &PromptVar = 'ALL';
-SET &WhereVar = IF &PromptVar EQ 'ALL' THEN '''ALL'' OR (1 EQ 1)' ELSE '''' | &PromptVar | '''';

It basically says to disregard this where test if the user types 'ALL' (since 1 EQ 1 is a tautology). The above syntax will work if you're doing a where test against a string database field. If the field is numeric, you'll have to do a slight modification:
-SET &WhereVar= IF &PromptVar EQ 'ALL' THEN '1 OR (1 EQ 1)' ELSE &PromptVar ;

Then down in the where tests, just do:
WHERE (field1 EQ &WhereVar1) AND (field2 EQ &WhereVar2);

Notice there are no quotes around &WhereVar, regardless of whether the DB field is alpha or numeric. Also, you'll have to make sure that parnetheses get put around each of these where tests, OR you can put each test in a separate WHERE (since FOCUS puts implied parentheses around each WHERE and an AND between them). If you're not careful, some misplaced parentheses can result in inadvertent full-table-scans.

Another possibility might be to use a multi-select list-box instead of a drop-down.

I hope this helps.
-Michael
 
Report This Post
Platinum Member
posted Hide Post
May be this "short" and full example helps:


-* PFMIKSEL - {2003.12.17} - Mikel G�mez - Full/Fast Dyn.Select Demo.

-* Vars. declaration.
-DEFAULT &COUNTRY = ' ' ;

-* Dynamic List.
TABLE FILE CAR
SUM
COMPUTE SEL/A10 =
IF COUNTRY EQ '&COUNTRY' THEN ' selected' ELSE ' ' ; NOPRINT
COMPUTE OPC/A128 =
'' ;
ON TABLE SET HOLDLIST PRINTONLY
BY COUNTRY NOPRINT
ON TABLE HOLD AS SELECT FORMAT ALPHA
END
-RUN

-* Filters.
-SET &WHERE1 =
- IF &COUNTRY EQ 'ALL' THEN ' '
- ELSE 'WHERE COUNTRY EQ ''&COUNTRY.EVAL''' ;

-* Report with COUNTRY filter.
TABLE FILE CAR
SUM SALES RCOST DCOST
BY COUNTRY SUMMARIZE
BY CAR
BY MODEL
&WHERE1
ON TABLE HOLD AS REPORT FORMAT HTMTABLE
END
-RUN

-* HTML Output.
-HTMLFORM BEGIN











!IBI.FIL.REPORT;


-HTMLFORM END
Note: Change the action and IBIF_ex value in the HTML form.

Regards,
Mikel

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

 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Platinum Member
posted Hide Post
The new way to accomplish this will be to use
the expanded &er variable support.

The syntax will be..
&VAR.( OR ( ALL , ONE , TWO, THREE)). ;

First this is a multivalued drop down list, and that is in the 5.2.3 release. The keyword 'OR' just connects the items when there are more than one selected, and if the first item on the list is the word ALL it means all of the items on the list.

Comments...
 
Posts: 226 | Registered: June 08, 2003Report This Post
Expert
posted Hide Post
another way is to use the wild card as the value for ALL
e.g. if your field is 5 characters long
<OPTION SELECTED VALUE='$$$$$'>All cars</OPTION>
<OPTION....continue on with the rest of your list

or you can use '$*' if you don't know how long the value is gonna be.

thing is, it slows your retrieval a bit, because you're processing an IF statement that you really dont need, so the post 2 up from this , the one that sets your filter to ' ' , is the way i do it, as well. But for shorter files, the wildcard method works like a charm.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
Mikel,
I used your example and got it to work.... Thanks for responding to my call for assistance. For future reference I've included your example, with the change " -HTMLFORM HTMTABLE " I had to do before I could get it to work.....

Thanks again.....
Smiler
-* PFMIKSEL - {2003.12.17} - Mikel G�mez - Full/Fast Dyn.Select Demo.

-* Vars. declaration.
-DEFAULT &COUNTRY = ' ' ;

-* Dynamic List.
TABLE FILE CAR
SUM
COMPUTE SEL/A10 =
IF COUNTRY EQ '&COUNTRY' THEN ' selected' ELSE ' ' ; NOPRINT
COMPUTE OPC/A128 =
'<option ' || SEL || ' value="' || COUNTRY || '">' ||
COUNTRY || '</option>' ;
ON TABLE SET HOLDLIST PRINTONLY
BY COUNTRY NOPRINT
ON TABLE HOLD AS SELECT FORMAT ALPHA
END
-RUN

-HTMLFORM HTMTABLE
 
Posts: 132 | Location: Kansas | Registered: November 12, 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     Building dynamic drop-down boxes/ALL option

Copyright © 1996-2020 Information Builders