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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Sorting Problem
 Login/Join
 
Silver Member
posted
I need to fill 2 buckets. One that has all people WITH apples and with other fruits. The other that has people WITHOUT apples and with other fruits.

File contains:

John, apples
John, bananas
John, peaches
Sue, bananas
Sue, peaches
Fred, apples
Fred, oranges

Sorting by fruit, then by name will give me output showing John, Sue and Fred displayed multiple times for each type of fruit available.

How do I test for the existence of an apple which will determine which bucket a person and ALL his fruit will dump into?

Would appreciate any help anyone can give me.

Thanks! vickie
 
Posts: 37 | Location: Springfield, MA | Registered: December 03, 2004Report This Post
Platinum Member
posted Hide Post
Here is one way. Mainframe focus 7.11. I'm sure there are many others that are better. Using the Car file, this creates a report separating cars that have coupes and cars that do not have coupes.

TABLE FILE CAR
PRINT BODYTYPE BY CAR UNDER-LINE
BY MODEL
END

PAGE 1


CAR MODEL BODYTYPE
--- ----- --------
ALFA ROMEO 2000 GT VELOCE COUPE
2000 SPIDER VELOCE ROADSTER
2000 4 DOOR BERLINA SEDAN
--------------------------------------------------------
AUDI 100 LS 2 DOOR AUTO SEDAN
--------------------------------------------------------
BMW 2002 2 DOOR SEDAN
2002 2 DOOR AUTO SEDAN
3.0 SI 4 DOOR SEDAN
3.0 SI 4 DOOR AUTO SEDAN
530I 4 DOOR SEDAN
530I 4 DOOR AUTO SEDAN
--------------------------------------------------------
DATSUN B210 2 DOOR AUTO SEDAN
--------------------------------------------------------
JAGUAR V12XKE AUTO CONVERTIBLE
XJ12L AUTO SEDAN
--------------------------------------------------------
JENSEN INTERCEPTOR III SEDAN
--------------------------------------------------------
MASERATI DORA 2 DOOR COUPE
--------------------------------------------------------
PEUGEOT 504 4 DOOR SEDAN
--------------------------------------------------------
TOYOTA COROLLA 4 DOOR DIX AUTO SEDAN
--------------------------------------------------------
TRIUMPH TR7 HARDTOP
--------------------------------------------------------


DEFINE FILE CAR
COUPECNT/I1=IF BODYTYPE EQ 'COUPE' THEN 1 ELSE 0;
END
TABLE FILE CAR
SUM COUPECNT
BY CAR
PRINT BODYTYPE BY CAR UNDER-LINE
BY MODEL
ON TABLE HOLD
END
DEFINE FILE HOLD
MSG1/A30=IF COUPECNT GT 0 THEN 'CARS LINES WITH COUPES' ELSE
'CARS LINES WITH WITHOUT COUPES' ;
END
TABLE FILE HOLD
PRINT BODYTYPE BY MSG1 NOPRINT BY CAR UNDER-LINE
BY MODEL
ON MSG1 SUBHEAD
"<MSG1 </1"
END


CAR MODEL BODYTYPE
--- ----- --------
CARS LINES WITH COUPES

ALFA ROMEO 2000 GT VELOCE COUPE
2000 SPIDER VELOCE ROADSTER
2000 4 DOOR BERLINA SEDAN
--------------------------------------------------------
MASERATI DORA 2 DOOR COUPE
--------------------------------------------------------
CARS LINES WITH WITHOUT COUPES

AUDI 100 LS 2 DOOR AUTO SEDAN
--------------------------------------------------------
BMW 2002 2 DOOR SEDAN
2002 2 DOOR AUTO SEDAN
3.0 SI 4 DOOR SEDAN
3.0 SI 4 DOOR AUTO SEDAN
530I 4 DOOR SEDAN
BMW 530I 4 DOOR AUTO SEDAN
--------------------------------------------------------
DATSUN B210 2 DOOR AUTO SEDAN
--------------------------------------------------------
JAGUAR V12XKE AUTO CONVERTIBLE
XJ12L AUTO SEDAN
--------------------------------------------------------
JENSEN INTERCEPTOR III SEDAN
--------------------------------------------------------
PEUGEOT 504 4 DOOR SEDAN
--------------------------------------------------------
TOYOTA COROLLA 4 DOOR DIX AUTO SEDAN
--------------------------------------------------------
TRIUMPH TR7 HARDTOP
--------------------------------------------------------


END OF REPORT
 
Posts: 115 | Location: Chicago, IL | Registered: May 28, 2004Report This Post
Silver Member
posted Hide Post
Thanks! Looks like it's exactly what I need...vickie
 
Posts: 37 | Location: Springfield, MA | Registered: December 03, 2004Report This Post
Silver Member
posted Hide Post
Thanks, ET, the above code worked fine. But apparently not what was wanted.

I need to isolate all people who hold ONLY apples and not any other fruit. How would I adjust the code to accomplish this? My sample scenario has no individuals with apples only, but that is what I need to identify.

I've been playing around, hoping to get the right output, but have not been successful.

Any ideas? Thanks, vickie
 
Posts: 37 | Location: Springfield, MA | Registered: December 03, 2004Report This Post
Virtuoso
posted Hide Post
Try the following example. This will give you cars that ONLY have a SEDAN bodytype.

The following finds CARs that have other BODYTYPEs and puts their names into a save file.

TABLE FILE CAR
BY CAR
WHERE BODYTYPE NE 'SEDAN'
ON TABLE SAVE AS 'OTHRMODL'
END

The following then uses the save file to EXCLUDE them from a report so that CARs which only offer a BODYTYPE of SEDAN are shown.

TABLE FILE CAR
PRINT BODYTYPE
BY COUNTRY BY CAR BY MODEL
IF CAR NE (OTHRMODL)
END
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Platinum Member
posted Hide Post
Here's another idea:

This will give you cars that have only bodytype = coupe.

DEFINE FILE CAR
COUPE_CNT/I5 = IF BODYTYPE EQ 'COUPE' THEN 1 ELSE 0;
OTHER_CNT/I5 = IF BODYTYPE EQ 'COUPE' THEN 0 ELSE 1;
TOTAL_CNT/I5 = 1;
END
TABLE FILE CAR
SUM
COUPE_CNT
OTHER_CNT
TOTAL_CNT
BY CAR
PRINT BODYTYPE
BY CAR
BY MODEL
ON TABLE HOLD AS HOLD1
END
-*
TABLE FILE HOLD1
PRINT
MODEL
BODYTYPE
BY CAR
BY COUPE_CNT
BY OTHER_CNT
BY TOTAL_CNT
WHERE COUPE_CNT GT 0
WHERE OTHER_CNT EQ 0
END

Jim
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Virtuoso
posted Hide Post
Jim's solution could be reduced to one pass and no HOLD file by using the WHERE TOTAL selection statement.

DEFINE FILE CAR
COUPE_CNT/I5 = IF BODYTYPE EQ 'COUPE' THEN 1 ELSE 0;
OTHER_CNT/I5 = IF BODYTYPE EQ 'COUPE' THEN 0 ELSE 1;
TOTAL_CNT/I5 = 1;
END
TABLE FILE CAR
SUM COUPE_CNT OTHER_CNT TOTAL_CNT
BY CAR
PRINT BODYTYPE
BY CAR BY MODEL
WHERE TOTAL COUPE_CNT GT 0
WHERE TOTAL OTHER_CNT EQ 0
END
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Silver Member
posted Hide Post
Thank you both for the quick response! Will try what you've suggested.

vickie
 
Posts: 37 | Location: Springfield, MA | Registered: December 03, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders