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 retrieve results if second table of join is missing

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] How to retrieve results if second table of join is missing
 Login/Join
 
Platinum Member
posted
I am joining 2 tables with about a million records in each table. I want only those records where there is not a matched value in the second joined table. Where 'is missing' did not work. With the example below, I want the EMPDATE.PIN files that do not have a match in TRAINING.

I can join the fields and create a hold file and on that hold file create the criteria which works but I do not want to retrieve all million records in a hold file to find the 500 or so that are not in the second table.

Does anyone have a suggestion on how to do this? Most likely that will not be the case with the example below but it shows the idea.

SET ASNAMES = ON
JOIN
EMPDATA.EMPDATA.PIN IN EMPDATA TO MULTIPLE TRAINING.TRAINING.PIN IN TRAINING
AS J2
END
TABLE FILE EMPDATA
PRINT
PIN AS 'EMPDATAPIN'
PIN AS 'TRAININGPIN'
COURSECODE
EXPENSES
ON TABLE HOLD AS TEMP01
END

TABLE FILE TEMP01
PRINT
EMPDATAPIN
COURSECODE
EXPENSES
WHERE TRAININGPIN IS MISSING;
ON TABLE HOLD AS TEMP02
END

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




Prod: WebFOCUS 7.7.05 OS:Linux; Upgrading to: WebFOCUS 8.1.05 OS:Windows; Outputs: HTML, PDF, Excel; Adapters: SAP, MySQL, Oracle incl Report Caster
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Platinum Member
posted Hide Post
Geri,
Take a look at MATCH using OLD-NOT-NEW this will return records from the first request that do not have records in the second file.

ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
 
Posts: 130 | Location: Columbus, Ohio | Registered: February 25, 2009Report This Post
Platinum Member
posted Hide Post
I have used match before but only on hold files. I will try match on the masters and let you know how well it works for this.

Thank you
Geri




Prod: WebFOCUS 7.7.05 OS:Linux; Upgrading to: WebFOCUS 8.1.05 OS:Windows; Outputs: HTML, PDF, Excel; Adapters: SAP, MySQL, Oracle incl Report Caster
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Virtuoso
posted Hide Post
SET ALL = ON

This will change the JOIN to act like an OUTER JOIN.

Then try running your request again with the WHERE clause in the first TABLE FILE statement.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Platinum Member
posted Hide Post
....and thats the difference between Virtuoso
and Gold Member...lol

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


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
 
Posts: 130 | Location: Columbus, Ohio | Registered: February 25, 2009Report This Post
Virtuoso
posted Hide Post
MATCH FILE, which merges complete results extracted from two datasources, is inadvisable, if either of the two extracts will be voluminous. (That depends on the selection criteria imposed in your real-world situation.)

You are essentially looking for an "if not exists" type of test. CONTAINS and OMITS test for existence of a suitable "child" instance (an instance in the Many side of a One-to-Many join). OMITS is the proper tool:

JOIN
PIN IN EMPDATA TO MULTIPLE PIN IN TRAINING
END

DEFINE FILE EMPDATA
MATCHED/A1=
IF TRAINING.TRAINING.PIN EQ EMPDATA.EMPDATA.PIN
THEN 'Y'
ELSE 'N';
END

TABLE FILE EMPDATA
"EMPLOYEES WITH NO TRAINING RECORDS"
""
PRINT
EMPDATA.EMPDATA.LASTNAME NOPRINT
BY TOTAL EMPDATA.EMPDATA.LASTNAME
BY PIN
IF MATCHED OMITS 'Y'
ON TABLE SET ALL ON
END

Here, OMITS is applied to a *defined* alpha field associated with the Training side of the join; and SET ALL=ON ensures that a row will be retrieved (with default values for the child columns), and MATCHED will be evaluated as 'N', when there is no matching child instance.

Note that the test assumes that blanks (or zero) is not a valid key value.

This message has been edited. Last edited by: j.gross,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
quote:
SET ASNAMES = ON
JOIN
EMPDATA.EMPDATA.PIN IN EMPDATA TO MULTIPLE TRAINING.TRAINING.PIN IN TRAINING
AS J2
END
TABLE FILE EMPDATA
PRINT
PIN AS 'EMPDATAPIN' <--- 1
PIN AS 'TRAININGPIN' <--- 1
COURSECODE
EXPENSES
ON TABLE HOLD AS TEMP01
END

TABLE FILE TEMP01
PRINT
EMPDATAPIN
COURSECODE
EXPENSES
WHERE TRAININGPIN IS MISSING; <--- 2
ON TABLE HOLD AS TEMP02
END


Two comments to your code:
1. You need to qualify the fieldnames. As it stands, *both* columns will report the value in EMPDATA.EMPDATA.PIN.
2. If your key field is not nullable, IS MISSING will never be true (regardless of SET ALL).
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Match works for what we need. Thanks!




Prod: WebFOCUS 7.7.05 OS:Linux; Upgrading to: WebFOCUS 8.1.05 OS:Windows; Outputs: HTML, PDF, Excel; Adapters: SAP, MySQL, Oracle incl Report Caster
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Gold member
posted Hide Post
Hi Geri,
Did you try
Where pin NE ''
Or Where table1.pin NE table2.pin
Sometimes this works.


7.7.01,windows2008 R2
 
Posts: 65 | Registered: July 28, 2011Report 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 retrieve results if second table of join is missing

Copyright © 1996-2020 Information Builders