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     [CLOSED] Instances of Sub-String in a string

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Instances of Sub-String in a string
 Login/Join
 
Silver Member
posted
All,

I have done some searching through the archives, and can't find exactly what I am looking for. I have a parameter being passed to my fex from an html painter multi-select box. What I am wanting to do is get a count on how many selections were made. I realize I can count the OR portions, but am driving myself nuts with how to do so.

This message has been edited. Last edited by: Kerry,


WF 7.6.4
Windows XP and UNIX
 
Posts: 41 | Registered: November 26, 2008Report This Post
Virtuoso
posted Hide Post
When you use a multi-select control, and indexed parameter set is created with the first variable containing a count of the selections made. For example, if you are passing COUNTRY from a multi-select box and selected ENGLAND and FRANCE, &COUNTRY0=2 (the number of selections) &COUNTRY1=ENGLAND and &COUNTRY2=FRANCE. So if you need to do looping, etc. you and use that 0 variable to tell you the number of selections made.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
Darin, I don't think this happens with those new-fangled formless launch pages generated by the GUI. I haven't created one yet, but I think the selection criteria is one variable, each value separated by " OR ".

here's one solution to counting how many ORs there are:

-SET &ECHO=ALL;

-SET &STRING1 = '''ENGLAND'' OR ''FRANCE'' OR ''JAPAN'' OR ''ITALY''';

-TYPE &STRING1

-*-- Remove the " OR " substring from the string -----------------------------------------
-SET &STRING2 = STRREP (&STRING1.LENGTH, &STRING1.QUOTEDSTRING, '4', ' OR ', 0, 'NULL', &STRING1.LENGTH, 'A&STRING1.LENGTH');

-TYPE &STRING2

-*-- Determine the difference between the string with and without the " OR " substring ---
-*   Divide by 4 (number of characters in the substring, add 1 to determine the number of values in the string
-SET &NBR_SEL =
-  (( ARGLEN(&STRING1.LENGTH, &STRING1.QUOTEDSTRING, 'I4') - ARGLEN(&STRING2.LENGTH, &STRING2.QUOTEDSTRING, 'I4') ) / 4) + 1;

-TYPE NUMBER OF SELECTED VALUES: &NBR_SEL


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
Virtuoso
posted Hide Post
That sounds pretty dumb to me - like a step backwards. That assumes that the ONLY way you want to use that parameter is for a selection criteria. That goes against the nature of an &var which is that you can use it for ANYTHING!

What if you want to use your parm values in a multi-line footing, or perhaps to use in a loop to generate several different procedures, etc. etc.? Now rather than having your variables independent of each other, you have to take the string and count the OR's as you have done and parse it into individual parameters.

If this is the "new" functionality, I'd better get on somebody's case immediately.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Going back through the docs, it looks like the answer is "it depends." The indexed variables are still available (reference is Chapter 4 of the "Developing Reporting Applications" manual. Even the manual on using the GUI states that "In order to provide multiple values, the procedure must be set up to accept
multiple values."

If the functionality described by Francis is available as well, you get to pick whichever one works the best for you. Best of both worlds.

For this case, the indexed parameters would seem to be an easier route, but Francis' solution is a good one either way.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
Darin, good to know there's a choice...


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
Silver Member
posted Hide Post
The question is how to make the choice... is it done by setting the operator to OR them from the GUI? I actually would have use for both, as I will use it in the selection, but I have logic if only a single selection is made that I want to run.

Francis, the code works for what I am trying to do, so thanks a bunch.


WF 7.6.4
Windows XP and UNIX
 
Posts: 41 | Registered: November 26, 2008Report This Post
Virtuoso
posted Hide Post
But be aware that the old method, with indexed vaiables, presents the values differently for the three possible cases:

a. If no entries were selected, no amper variables are set.

b. If exactly one entry was selected, it acts like a simple text input:
&VAR is set to the selectd Value; &VAR0 ad &VAR1 do not exist.

c. When more than one entry was selected (and only then) you get indexed variables:
&VAR0 = number of selections
&VAR1, &VAR2, ... are the values selected
and &VAR is a courtesy copy of &VAR1.

If you want to have an indexed set in all cases, the following series of four lines (the order is important), placed at the top of the fex, will do it. It correctly supplies &VAR0, &VAR, and &VAR1 when they do not yet exist, but leaves them unchanged if already present -- allowing code to branch or -REPEAT based on &VAR0, regardless of how many values were selected.

-DEFAULT &VAR0 = &VAR.EXISTS;
-SET     &VAR0 = &VAR0.EVAL;
-DEFAULT &VAR  = '';
-DEFAULT &VAR1 = &VAR.EVAL;


- 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
i have the same ? as DW... how do you make the choice in the GUI ?
i had actually written code to loop thru the '..OR..' statement and turn it back into the &var0, &var1,... &varn.
Talk about retrograde reverse engineering !

Jack, do you know how to make the GUI do it?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 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     [CLOSED] Instances of Sub-String in a string

Copyright © 1996-2020 Information Builders