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] DEFINEs in IA - using LIKE or CONTAINS

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DEFINEs in IA - using LIKE or CONTAINS
 Login/Join
 
Platinum Member
posted
I have a user trying to create a define field in InfoAssist to this effect:
IF FIELDA LIKE '%' THEN FIELDB ELSE MISSING.

FIELDA has values like "5%" and "10%" and "$5000". InfoAssist isn't having any of this. How do we make this work?

Thanks!

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


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 183 | Location: Indiana | Registered: December 05, 2017Report This Post
Virtuoso
posted Hide Post
Deb

With 8.2.06 I had no luck with LIKE but CONTAINS works just fine in a WHERE statement, but if I replicate your DEFINE I have the same issue as you neither LIKE or CONTAINS works. Better open a case with techsupport...

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


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Master
posted Hide Post
quote:
IF FIELDA LIKE '%' THEN FIELDB ELSE MISSING.


This answer assumes the following:
1. FIELDA is an ALPHA field, because LIKE only works on text strings
2. That you are trying to get the ALPHA values that have the percent sign in it.

The percent sign in a LIKE statement is a wildcard. So the statement above is basically saying if the field has anything in it, then return the field. Also if you want MISSING values, you need to set MISSING=ON.

So to get fields with the percent sign, you need to escape the percent sign. Something like this
  
DEFINE FILE masterFileName
NEWFIELDNAME/A50V MISSING ON = IF FIELDA LIKE '%~%%' ESCAPE '~' THEN FIELDB ELSE MISSING.
END DEFINE


More info here: Using an Escape Character for LIKE


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Platinum Member
posted Hide Post
Yes, FIELDA is an alpha field. Sorry I didn't clarify that.

quote:
IF FIELDA LIKE '%~%%' ESCAPE '~' THEN FIELDB ELSE MISSING.


I get an error when I try that. InfoAssist doesn't seem to like ESCAPE. I tried using other characters in place of ~ and got the same error. :/


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 183 | Location: Indiana | Registered: December 05, 2017Report This Post
Master
posted Hide Post
quote:
Originally posted by DWaybright:
I get an error when I try that. InfoAssist doesn't seem to like ESCAPE. I tried using other characters in place of ~ and got the same error. :/


*SIGH* Yeah, sorry. I just noticed that. Once again IA saying perfectly valid code is invalid.

I'm trying one other thing of using a REGEX to see if there is a percent sign in the text. I'll post the answer if it works.


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Master
posted Hide Post
The REGEX seems to work for me:
  
IF REGEX(FIELDA, '[%]') THEN FIELDB ELSE MISSING;

I built this code in IA and it seemed to work:
  
DEFINE FILE ibisamp/car
Margin/D12.2%=(CAR.BODY.RETAIL_COST / CAR.BODY.DEALER_COST -1)*100;
FIELDA/A25=IF CAR.BODY.SEATS EQ 5 THEN TRIM_(BOTH, ' ', FTOA( CAR.BODY.SALES, '(D12M)', 'A25V')) ELSE TRIM_(BOTH, ' ',FTOA( Margin ,'(D12.2%)', 'A15'));
FIELDB/D12M=CAR.BODY.SALES ;
FIELDC/D12M MISSING ON=IF REGEX(FIELDA, '[%]') THEN FIELDB ELSE MISSING;
END
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET SQUEEZE=ON
-DEFAULTH &WF_HTMLENCODE=ON;
SET HTMLENCODE=&WF_HTMLENCODE

SET HTMLCSS=ON
-DEFAULTH &WF_EMPTYREPORT=ON;
SET EMPTYREPORT=&WF_EMPTYREPORT

-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
TABLE FILE ibisamp/car
SUM FIELDA
FIELDB
FIELDC
BY CAR.ORIGIN.COUNTRY
BY CAR.COMP.CAR
BY CAR.CARREC.MODEL
BY CAR.BODY.SEATS
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET CACHELINES 100
ON TABLE SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/endeflt.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, $
ENDSTYLE
END

-RUN



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Master
posted Hide Post
More info on REGEX here: REGEX: Matching a String to a Regular Expression


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Platinum Member
posted Hide Post
Hallway - You're a genius! Smiler
REGEX works! Thank you!

Focal Point comes through for me again.


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 183 | Location: Indiana | Registered: December 05, 2017Report This Post
Master
posted Hide Post
🙌

Glad to help


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report 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] DEFINEs in IA - using LIKE or CONTAINS

Copyright © 1996-2020 Information Builders