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]How to filter records

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]How to filter records
 Login/Join
 
Member
posted
Hi,
How do I filter out an entire record based on a particular value?

For example
  
TABLE FILE CAR
PRINT SEATS
BY CAR
END


I want to eliminate CAR's where SEATS EQ to 2.
So Alpha Romeo has values of 4, 2 and 2.
I don't want to see the entire record of Alpha Romeo, because one of the values is a 2.
The end result should only show, AUDI, BMW, DATSUN, JENSEN, PEUGEOT and TOYOTA.
Thank you.

This message has been edited. Last edited by: nickz,
 
Posts: 12 | Registered: September 13, 2019Report This Post
Platinum Member
posted Hide Post
Hello,
Hope this will be useful

SET ASNAMES=ON

SET HOLDLIST=PRINTONLY

TABLE FILE CAR
PRINT 
SEATS
BY CAR
ON TABLE HOLD AS TEST_1 FORMAT ALPHA
END
-RUN


TABLE FILE CAR
PRINT 
SEATS AS 'FIL_COL'
BY CAR AS 'CAR_1'
WHERE SEATS EQ 2
ON TABLE HOLD AS TEST_2 FORMAT ALPHA
END
-RUN

JOIN CAR IN TEST_1 TO CAR_1 IN TEST_2 AS J2

TABLE FILE TEST_1
PRINT
CAR
SEATS
WHERE FIL_COL NE 2
END
-RUN


Thank You.
 
Posts: 109 | Registered: February 02, 2016Report This Post
Master
posted Hide Post
This works with a single request:
 
DEFINE FILE CAR
SEATFLAG/I1=IF SEATS EQ 2 THEN 1 ELSE 0;
END
TABLE FILE CAR

PRINT SEATS
SUM.SEATFLAG WITHIN CAR NOPRINT
BY CAR
WHERE TOTAL SEATFLAG EQ 0;
END 


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
Or if you just want a list of the cars without showing the seat numbers:
  
DEFINE FILE CAR
SEATFLAG/I1=IF SEATS EQ 2 THEN 1 ELSE 0;
END
TABLE FILE CAR

SUM SEATFLAG WITHIN CAR NOPRINT
BY CAR
WHERE TOTAL SEATFLAG EQ 0;
END


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
It is true as Hallway indicates it can be done in one table request. However the WHERE TOTAL has the disadvantage of being performed by WebFocus, so all data is first transferred from the database to the Webfocus server. No problem with small datasets, but if you are dealing with large dataset it could be better to do in 2 passes:

TABLE FILE CAR
PRINT DST.CAR
WHERE SEATS EQ 2;
ON TABLE HOLD AS HLDSEATS2 FORMAT ALPHA
END
-RUN

TABLE FILE CAR
PRINT
CAR
SEATS
WHERE NOT CAR IN FILE HLDSEATS2;
END
-RUN


Or even better with subquery to leave everything to database:

TABLE FILE CAR
PRINT DST.CAR
WHERE SEATS EQ 2;
ON TABLE HOLD AS SQLSEATS2 FORMAT SQL_SCRIPT
END
-RUN

TABLE FILE CAR
PRINT
CAR
SEATS
WHERE NOT DB_INFILE(SQLSEATS2, CAR, CAR);
END
-RUN
-EXIT


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
Or, if you don't need the output right away:
MATCH
 FILE CAR
 PRINT SEATS
 BY CAR
 RUN
 FILE CAR
 BY CAR
 WHERE SEATS EQ 2;
AFTER MATCH HOLD AS WHATEVER
 OLD-NOT-NEW
END


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
Member
posted Hide Post
Thank you everyone.
 
Posts: 12 | Registered: September 13, 2019Report This Post
Platinum Member
posted Hide Post
Good One
 
Posts: 109 | Registered: February 02, 2016Report This Post
Master
posted Hide Post
quote:
...Or even better with subquery to leave everything to database:...FORMAT SQL_SCRIPT...

+1
 
Posts: 822 | Registered: April 23, 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     [SOLVED]How to filter records

Copyright © 1996-2020 Information Builders