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] Include/Exclude data based on Characters in a field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Include/Exclude data based on Characters in a field
 Login/Join
 
Silver Member
posted
Hello, I am trying to achieve something that is rather tricky. I am new to WebFocus and don't really know how to go about this.

I am creating 2 reports, which have same fields with the only exception being excluding and including data based on Characters in field name.

Example 1: IF server name is 9 characters long AND IF first two characters are either R1 or R3 AND fifth character is either P or V then do not include these in output.


Example 2: (Total opposite of ex.1)

IF server name is 9 characters long
AND IF first two characters are either R1 or R3 AND fifth character is either P or V then ONLY include these in output.


Can someone help me with this matter? If there is a way to create ONE define for each scenario that would be very ideal.

Thank you in advance!

Regards,
Gagan

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


WebFOCUS 8
Windows, All Outputs
 
Posts: 29 | Registered: September 05, 2017Report This Post
Expert
posted Hide Post
Most things are possible as you see below. The only thing I would suggest that you do, would be to check the SQL generated by your request and check that it is efficient.

There are many posts regarding trapping SQL.

DEFINE FILE GGSALES
  DO_I_WANT_IT/A1 = IF ARGLEN(20,CITY,'I11') EQ 7 AND EDIT(CITY,'9$$99$') IN ('Cca','Hst') THEN 'Y' ELSE 'N';
END

TABLE FILE GGSALES
  SUM DOLLARS
      DO_I_WANT_IT
   BY REGION
   BY ST
   BY CITY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
     INCLUDE = warm,
$
ENDSTYLE
END


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
Virtuoso
posted Hide Post
quote:
excluding and including data based on Characters in field name.


If I understand this right, you want to include only columns with specific values in their name. If that's the case you'll probably have to first parse out the metadata and hold the output and then use the hold file to create the report you're trying to assemble. If this is correct you have to look at the table called SYSCOLUM. Here's an example of how you can query the metadata for car file:
TABLE FILE SYSCOLUM
PRINT NAME
BY TBNAME
WHERE TBNAME EQ 'CAR';
END  


You can find out what's available in SYSCOLUM by issuing this command:
 ?FF SYSCOLUM 


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
Take a look at the REGEX function. Very powerful, if you know how to make regular expressions.

Martin.


WebFocus 8206M, iWay DataMigrator, Windows, DB2 Windows V10.5, MS SQL Server, Azure SQL, Hyperstage, ReportCaster
 
Posts: 168 | Registered: March 29, 2013Report This Post
Virtuoso
posted Hide Post
I was under the impression that WF does not have a REGEX function, but in this case I'd be rather happy to be proven wrong.

Could you point to where it's documented?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
For variables yes but I was not aware that it applied to DEFINEs.

Document link - 8th item in right hand list.

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
Virtuoso
posted Hide Post
I did some testing. Apparently it also exists as a function that requires 3 parameters, but which is which???

I tried a couple of things without much success:
-SET &XA = REGEX('^\d{4}$', '1234', '');
-SET &YA = REGEX('1234', '^\d{4}$', '');
-SET &ZA = REGEX('1234', '', '^\d{4}$');
-TYPE &XA / &YA / &ZA


Which promisingly results in: 1 / 1 / 0

-SET &XB = REGEX('^\d{4}$', 'abcd', '');
-SET &YB = REGEX('abcd', '^\d{4}$', '');
-SET &ZB = REGEX('abcd', '', '^\d{4}$');
-TYPE &XB / &YB / &ZB


Which also results in: 1 / 1 / 0

It does not appear that the third parameter is for the return type, as usual. I think it may be for REGEX flags, such as 'g' for 'global search' (repeated matches in the same string, for example), but that's just a guess based on what I know of other REGEX implementations...

And... if we have a function REGEX, do we also have related functions that use the result of a REGEX for, say, string replacement? Just knowing that a string matches a pattern is often not that useful.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
As is usual, new features are not well documented when they first appear.

In the v8.2.02 online documentation (that uses crazy, not book-markable navigation) look for Reporting Language > Using Functions > Simplified Character Functions > REGEX.

There are two arguments:
REGEX(string, regular_expression)

And there's this regarding regular expressions: "For a basic summary, see the section Summary of Regular Expressions in Chapter 2, Security, of the Server Administration manual." - seems like an odd place to be sent to...

This message has been edited. Last edited by: Francis Mariani,


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     [CLOSED] Include/Exclude data based on Characters in a field

Copyright © 1996-2020 Information Builders