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     Multi-select Listbox on the fly.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Multi-select Listbox on the fly.
 Login/Join
 
Guru
posted
Hi All -

Another multi-select listbox question...
I have the sample code below. The code creates a multi-select listbox on the fly and then keeps the selected value highlighted after the form is submitted and a new session starts. If you select just one country, it works just fine. But, when more than one country is selected, the code uses the DEFAULT value instead of the values in the listbox (should be each value separated by OR). What am I doing wrong?

-* File testcar.fex
-DEFAULT &CNTRYSEL='JAPAN';
-SET &ECHO=ALL
DEFINE FILE CAR
CNTRYCHECK/A256=IF &CNTRYSEL.QUOTEDSTRING EQ GETTOK(&CNTRYSEL.QUOTEDSTRING,ARGLEN(256,&CNTRYSEL.QUOTEDSTRING,'I3'),-1,' OR ',10,'A10') THEN
                   ':'|&CNTRYSEL.QUOTEDSTRING||':'; ELSE
				   STRREP(256,&CNTRYSEL.QUOTEDSTRING,1,'''',1,':',256,CNTRYCHECK);
CNTRY/A22=':'|COUNTRY||':';
END
TABLE FILE CAR
SUM
COMPUTE PICKED/A8=IF CNTRYCHECK CONTAINS CNTRY THEN 'selected' ELSE ' '; NOPRINT
COMPUTE SELECT/A300='<option VALUE='|COUNTRY||' '|PICKED||' displaytext='''|COUNTRY||'''>'|COUNTRY||'</option>';
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS OPTIONS FORMAT ALPHA
END
-*
TABLE FILE OPTIONS
PRINT SELECT
ON TABLE HOLD AS OPTLINES FORMAT ALPHA
END
-RUN
-SET &PICKALL=IF '&CNTRYSEL.EVAL' EQ '$*' THEN 'selected' ELSE ' ';

TABLE FILE CAR
HEADING
" COUNTRY picked is &CNTRYSEL "
PRINT
   CAR
BY COUNTRY
WHERE COUNTRY EQ '&CNTRYSEL' ;
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN

<html>
<head>
<br />
!IBI.FIL.RPT1;
<br />
<form name='form1' method='POST' action='/ibi_apps/WFServlet?' target='_self'
 style='font-family: Arial; font-size: 8pt; word-spacing: 0; margin-top: 0; margin-bottom: 0; height:100%'>
<input type="hidden" name="IBIF_ex" value="testcar">

<p style='margin-top: 0; margin-bottom: 0'><b>Country</b></p>
<p style='margin-top: 0; margin-bottom: 0'><select id=listbox1 size=5 multiple name='CNTRYSEL' operation='OR'>
<option value='$*' &PICKALL.EVAL displaytext='All'>All</option>
!IBI.FIL.OPTLINES;
</select></p>
<br />
<p style='margin-top: 0; margin-bottom: 0'><input type='submit' value='Submit'  name='form1submit'></p>
</form>

</body>

</html>

-HTMLFORM END
-EXIT


I'm on 7.1.3. Thanks!


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Virtuoso
posted Hide Post
When I ran it, and peeked at View Source, I found:
0 ERROR AT OR NEAR LINE      7  IN PROCEDURE ADHOCRQ FOCEXEC *
  (FOC252) COMPUTATIONAL EXPRESSION NOT RECOGNIZED: ELSE
  STRREP(256,'JAPAN',1,'''',1,':',256,CNTRYCHECK)


There is a stray semicolon in the THEN clause of your define.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
The delimiter for GETTOK is a single character, so the call in your example uses Space as the delimiter.

Also, it appears that what you are attempting to calculate could be done in a -SET, and then referenced in the define as a simple quoted string.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
The operation='OR' is specific to HTML painter generated pages and IB javascript control.

What you get back from plain HTML is &CNTRYSEL for a single item or &CNTRYSEL0 and &CNTRYSEL1,&CNTRYSEL2 etc. for multiple selects. You can deal with this in WF, and there are some examples here, or in javascript, whichever you prefer.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
Your logic will not work, because on drilldown where multiple entries are selected the variable you are testing reflects only the first.

For example, when I select England, France and Italy, &CNTRYSEL contains just ENGLAND:
&CNTRYSEL = ENGLAND <--
&CNTRYSEL0 = 3
&CNTRYSEL1 = ENGLAND
&CNTRYSEL2 = FRANCE
&CNTRYSEL3 = ITALY

When WF generates a dynamic menu for autoprompting, it includes Javascript to sense the "operation='OR'" attribute and string the selections together. -- But without that JS infrastructure you just get the classic handling of multiple selections, returning the first (in the bare & var), a counter (with suffix 0), and the individual values (suffix 1,2...)

Unless you can piggyback IBI's JS, you'll have to handles the &vars in the classic manner (sensing existence of &CNTRYSEL0, if present looping thru the list of values, else using &CNTRYSEL's value)


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
quote:
sensing existence of &CNTRYSEL0

My suggestion is don't sense anything, make sure its there.
-DEFAULT &CNTRYSEL0 = 1 ;
-DEFAULT &CNTRYSEL1 = '&COUNTRYSEL.EVAL';

Also if you need to filter on these, I would suggest writing them to a file and either joining to it or us WHERE IN FILE


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Whoa. Is the 0,1,2,etc variables also created when using HTML Layout Painter? Because, I've used several multi-select listboxes via the painter and &var always contains 'this' or 'that' or 'the other'. So, I went ahead and modified my sample code just to try out the numbered vars and, by golly, it works! I had to build the where clause though. Here's the fex that works:
-* File testcar.fex
-DEFAULT &CNTRYSEL='$*';
-DEFAULT &ORSEL='';
-DEFAULT &CNTRYSEL0=0;
-DEFAULT &CNTRYSEL1='';
-SET &ECHO=ALL
TABLE FILE CAR
SUM
-IF &CNTRYSEL0 NE 0 THEN GOTO NEXT005;
-SET &ORSEL=''''||'&CNTRYSEL.EVAL'||'''';
COMPUTE PICKED/A8=IF COUNTRY EQ '&CNTRYSEL.EVAL' THEN 'selected' ELSE '        ';
-GOTO NEXT005E
-NEXT005
COMPUTE PICKED/A8=
-SET &KNT=0;
-REPEAT :LOOP010 &CNTRYSEL0 TIMES;
-SET &KNT=&KNT+1;
-IF &KNT EQ 1 THEN GOTO NEXT010;
-SET &ORSEL=&ORSEL | ' OR ''' | &CNTRYSEL&KNT.EVAL | '''';
ELSE IF COUNTRY EQ '&CNTRYSEL.&KNT' THEN 'selected'
-GOTO NEXT010E
-NEXT010
-SET &ORSEL=''''|'&CNTRYSEL1.EVAL'|'''';
IF COUNTRY EQ '&CNTRYSEL1.EVAL' THEN 'selected'
-NEXT010E
-TYPE &ORSEL
-:LOOP010
ELSE '        ';
-NEXT005E
COMPUTE SELECT/A300='<option VALUE='''||COUNTRY||''' '|PICKED||' displaytext='''||COUNTRY||'''>'||COUNTRY||'</option>';
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS OPTIONS FORMAT ALPHA
END
-*
TABLE FILE OPTIONS
PRINT SELECT
ON TABLE HOLD AS OPTLINES FORMAT ALPHA
END
-RUN
-IF &CNTRYSEL0 EQ 0 THEN GOTO NEXT015;
-SET &PICKALL=IF '&CNTRYSEL1.EVAL' EQ '$*' THEN 'selected' ELSE ' ';
-GOTO NEXT015E
-NEXT015
-SET &PICKALL=IF '&CNTRYSEL.EVAL' EQ '$*' THEN 'selected' ELSE ' ';
-NEXT015E

TABLE FILE CAR
HEADING
" COUNTRY picked is &ORSEL "
PRINT
   CAR
BY COUNTRY
WHERE COUNTRY EQ &ORSEL ;
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS RPT1 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN

<html>
<head>
<br />
!IBI.FIL.RPT1;
<br />
<form name='form1' method='POST' action='/ibi_apps/WFServlet?' target='_self'
 style='font-family: Arial; font-size: 8pt; word-spacing: 0; margin-top: 0; margin-bottom: 0; height:100%'>
<input type="hidden" name="IBIF_ex" value="testcar">

<p style='margin-top: 0; margin-bottom: 0'><b>Country</b></p>
<p style='margin-top: 0; margin-bottom: 0'><select id=listbox1 size=5 multiple name='CNTRYSEL' operation='OR'>
<option value='$*' &PICKALL.EVAL displaytext='All'>All</option>
!IBI.FIL.OPTLINES;
</select></p>
<br />
<p style='margin-top: 0; margin-bottom: 0'><input type='submit' value='Submit'  name='form1submit'></p>
</form>

</body>

</html>

-HTMLFORM END
-EXIT


Thank you guys!
Not important P.S. Anybody tried running a Focus report on an iPhone? They got all these apps for my phone now - I even got iPint where I can drink virtual beer. And I can make my phone a lightsaber with awesome sound effects. Or play Texas Hold 'Em Poker. Would be really awesome to get reports running on this thingamagig!


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Virtuoso
posted Hide Post
iPhone will display standard reports, no problem. Not sure about MRE and other proprietary WF stuff. The js can be an issue on non IE/Firefox browser, though getting better.

Look for Mobile Maintain though. That should be excellent.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Also check out the Mobile Favorites as presented at Summit.

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, 2004Report This Post
Expert
posted Hide Post
quote:
virtual beer
just got a really empty feeling in my belly...

I've been trying to procure an iPhone for the last week here in Toronto with no luck.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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     Multi-select Listbox on the fly.

Copyright © 1996-2020 Information Builders