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     which is more efficient -- contains or sbstr?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
which is more efficient -- contains or sbstr?
 Login/Join
 
Platinum Member
posted
I have to test for the first character of an alpha field. Which is more efficient in this case:

IF (SUBSTR(255, STMTURL, 1, 255, 1, 'A225V') EQ '<') THEN 1 ELSE 0;

OR

IF STMTURL CONTAINS '<' THEN 1 ELSE 0;


1. I was thinking CONTAINS because since we're testing for the first character, it doesn't have to parse and process the SUBSTR syntax.

2. Would SUBSTR be more efficient if we were testing for, say, the 100th character?


Thank you,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Virtuoso
posted Hide Post
Here a couple that may work as well--

1. IF EDIT(STMTURL,'9') EQ '<'

OR

2. IF STMTURL LIKE '<%'

OR

3. IF STMTURL EQ '<$*'
(This one won't work if STMTURL length is shorter than 3 characters - give a "Test value is longer than the field length" error.

I believe that any of these would be very efficient and very simple. I don't think CONTAINS can be passed to the DBMS.


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
In my experience the SUBSTR formula is more efficient because you point direct to the proper part of the field, the CONTAINS command tests every character in the field for the wanted value.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Platinum Member
posted Hide Post
Hi Frank,

So CONTAINS doesn't stop testing each character after it finds a match?

Thanks,

John


WF 7.7.03, Windows 7, HTML, Excel, PDF
 
Posts: 225 | Location: San Francisco Bay Area, California | Registered: October 26, 2006Report This Post
Virtuoso
posted Hide Post
It might also depend on the database you use.
A Focus database will act different compared to an SQL db.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
I have no idea John, but it is slower.
If you want to find out just test it on a big database where you know on what position certain values are.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report 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     which is more efficient -- contains or sbstr?

Copyright © 1996-2020 Information Builders