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     [SOLVED] Specific word in a alpha field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Specific word in a alpha field
 Login/Join
 
Gold member
posted
Hi

I need to define a field that will look for the word Rush in a comment field and will equal 1 if it does and 0 if it does not

I am not trying to find only the record with Rush in it but just show which record have and which don't

Problem is that comment field can show " Please ship rush ", " this order is rush ", " Rush order " and so on as these comment are not always enter by the same user

This is something I never did before and help would be greatly appreciated

Thank you.

This message has been edited. Last edited by: FP Mod Chuck,


7.6. / Win 7 / Excel
 
Posts: 56 | Location: St-Laurent QC Canada | Registered: February 04, 2009Report This Post
Virtuoso
posted Hide Post
Assuming you're running 8.2xx, try the POSITION function and count the ones that have a value not equal to 0.

https://webfocusinfocenter.inf.../source/position.htm


In this example I'm flagging the records that have 'GER' in the field COUNTRY.
  

TABLE FILE CAR
PRINT COUNTRY CAR
COMPUTE GER_IN_COUNTRY/I2=POSITION('GER', COUNTRY); NOPRINT
COMPUTE RECORDS_WITH_GER/I2=IF GER_IN_COUNTRY NE 0 THEN 1 ELSE 0;
END

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


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
And since the case may be important

TABLE FILE CAR
PRINT COUNTRY CAR
COMPUTE GER_IN_COUNTRY/I2=POSITION('GER', UPCASE(10, COUNTRY, 'A10')); NOPRINT
COMPUTE RECORDS_WITH_GER/I2=IF GER_IN_COUNTRY NE 0 THEN 1 ELSE 0;
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
There's also "CONTAINS" ...

TABLE FILE CAR
PRINT MODEL
BY COUNTRY
BY CAR
END
-*
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
BY CAR
WHERE MODEL CONTAINS 'AUTO' OR 'III'
END


You would still need to deal with mixed case values.


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Virtuoso
posted Hide Post
MartinY has a point. I'd upcase the values before checking.

FYI, there's now a simplified UPPER(fieldname) function that's slightly easier than UPCASE.

  
TABLE FILE CAR
PRINT COUNTRY CAR
COMPUTE GER_IN_COUNTRY/I2=POSITION('GER', UPPER(COUNTRY)); NOPRINT
COMPUTE RECORDS_WITH_GER/I2=IF GER_IN_COUNTRY NE 0 THEN 1 ELSE 0;
END


Regarding CONTAINS, I agree that's another way of approaching the issue. You could also use LIKE. Many ways to get to the same outcome.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
quote:
there's now a simplified UPPER(fieldname) function that's slightly easier than UPCASE

Old habits Smiler


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Virtuoso
posted Hide Post
The REGEX function returns 1 or 0 based on match:

This does a case insensitive search for the word "imports".

DEFINE FILE GGPRODS
IMP/I5 = REGEX(VENDOR_NAME,'(?i)\bimports\b');
END
TABLE FILE GGPRODS
PRINT *  IMP
END  


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report 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     [SOLVED] Specific word in a alpha field

Copyright © 1996-2020 Information Builders