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     Problem with FOCUS JOIN

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Problem with FOCUS JOIN
 Login/Join
 
Member
posted
I have two hold files that I'm attempting to JOIN together to add a value from one file to every corresponding value in the other file. Here is a generic representation of what I have and the desired output:

Table 1:
ID1, ID2, ID3, ID4, Value1
1, 2, 3, 4, 500
1, 2, 5, 6, 800
1, 2, 7, 8, 750

Table 2:
ID1, ID2, ID3, ID4, ID5, ValueA, ValueB
1, 2, 3, 4, 11, 100, 25
1, 2, 3, 4, 12, 250, 100
1, 2, 3, 4, 13, 300, 75
1, 2, 5, 6, 11, 200, 125
1, 2, 5, 6, 14, 225, 90
1, 2, 7, 8, 11, 75, 50

Desired Output After Join:
ID1, ID2, ID3, ID4, ID5, ValueA, ValueB, Value1
1, 2, 3, 4, 11, 100, 25, 500
1, 2, 3, 4, 12, 250, 100, 500
1, 2, 3, 4, 13, 300, 75, 500
1, 2, 5, 6, 11, 200, 125, 800
1, 2, 5, 6, 14, 225, 90, 800
1, 2, 7, 8, 11, 75, 50, 750

So far I have not been able to make this work. In the example above, I'll bring Value1 from Table 1 to the first corresponding record, but all subsequent records bring in Value1 as '0'.

When I set this up as a SQL Join I get the exact output I want, but the FOCUS Joins don't seem to be working the same. Any suggestions.


WF 7.1.1 - RedHat Linux - Tomcat - SQL Server 2000
 
Posts: 12 | Location: Chicago, IL | Registered: January 05, 2007Report This Post
Expert
posted Hide Post
shealy
we'ld have to see your masters
(so we can see the indexes) or
the code that produced the extract files (if by 'hold' files you mean that they are extract files)

then we'ld have to see your join
JOIN ID1 AND ID2 AND ID3 AND ID4 IN TABLE2 TO ID1 AND ID2 AND ID3 AND ID4 IN TABLE1 AS J2
then table against TABLE2
or..
JOIN ID1 AND ID2 AND ID3 AND ID4 IN TABLE1 TO ALL ID1 AND ID2 AND ID3 AND ID4 IN TABLE2 AS J1
and table agains TABLE1




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Shealy

Susannah is right, the master files and your code would be most helpful.

If they are truly HOLD files, then a JOIN table2 to table1 would be the correct approach. That would be Susanah's first example.

More information please.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Shealy :
Looks like you need use the ALL option. By default, a FOCUS join only connects to 1 record from the right-side file, where as SQL join is an INNER JOIN by default and is a one-to-many default.

Try this..
JOIN CLEAR *
JOIN ID1 AND ID2 AND ID3 AND ID4 IN TABLE1 TO
ALL ID1 AND ID2 AND ID3 AND ID4 IN TABLE2 AS JN01
END
-RUN

Sandeep Mamidenna
-*


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Sandeep

If the files are FIX format flat files, ie standard HOLD files, the unique join from table2 to table1 is correct. Using the ALL from table1 into table2 will not give the correct results. This is because of the way that flat files are read, in sequence order only.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Unfortunately we don't have our full metadata environment set yet, so at this time I'm pulling directly from SQL Server via SQL passthru. Below the the procedure I'm attempting to use once the pass through is complete (note: all 'id' fields are indexed keys on SQL Server)

--------------------------------------------------------------------------
TABLE FILE SQLOUT
SUM
COMPUTE cli_prod/A50 = IF close_client_name EQ open_client_name THEN 'Primary - ' | close_productcat
ELSE close_client_name | ' - ' | close_productcat;
COMPUTE cli_prod_id/I1 = IF close_client_name EQ open_client_name AND close_productcat EQ open_productcat THEN 1
ELSE IF close_client_name EQ open_client_name AND close_productcat NE open_productcat THEN 2
ELSE 3;
clicks
submits
installs
BY open_client_id
BY open_productcat_id
BY close_client_id
BY close_productcat_id
BY partner_id
ON TABLE HOLD AS EVENTS
END
-RUN
TABLE FILE EVENTS
PRINT
COMPUTE primary_submits/I6 = submits;
BY open_client_id
BY open_productcat_id
BY close_client_id
BY close_productcat_id
BY partner_id
WHERE cli_prod_id EQ 1;
ON TABLE HOLD AS PRI_ORD
END
-RUN
JOIN CLEAR *
JOIN
EVENTS.EVENTS.open_client_id AND EVENTS.EVENTS.open_productcat_id AND
EVENTS.EVENTS.partner_id
IN EVENTS
TO
PRI_ORD.PRI_ORD.open_client_id AND PRI_ORD.PRI_ORD.open_productcat_id AND
PRI_ORD.PRI_ORD.partner_id
IN PRI_ORD
AS JN01
END
TABLE FILE EVENTS
SUM primary_submits
submits
installs
BY open_client_id
BY open_productcat_id
BY partner_id
BY close_client_id
BY close_productcat_id
ON TABLE SET LINES 999999
ON TABLE SET PAGE NOPAGE
END
--------------------------------------------------------------------------
The returned results are only adding 'primary_submits' value to the first instance of the JOIN sequence. All other matches are being assigned 0.


WF 7.1.1 - RedHat Linux - Tomcat - SQL Server 2000
 
Posts: 12 | Location: Chicago, IL | Registered: January 05, 2007Report This Post
Platinum Member
posted Hide Post
I stand corrected Alan, Thank you. Guess I should have given my answer a little more thought before I pulled the trigger.

Gooooooooooood day !!
Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
I'll wait to be proved wrong on this!

A join between two HOLD files cannot be compared to a join between SQL tables. A HOLD file (or any flat file I believe) is read only from first record to last record, and that includes the x-referenced file. A read cannot move back in the file, as happens in SQL.

On first glance I would have said that this should work. Then I noticed that the sort to create the HOLD files used 5 BY fields, with the JOIN on BY fields 1,2 and 5. Please move the BY field number 5 to be number 3 on both requests.

I am hopeful that this could be the cause of your problem.

Otherwise, I do question the need to have a join at all. I would have thought you could use
COMPUTE primary_submits/I6 = IF cli_prd_id EQ 1 THEN submits ELSE 0;

and then just have one pass of the EVENTS HOLD file.

If this fails, may I suggest MATCH!


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
You might use the command

ON TABLE HOLD AS...FORMAT FOCUS INDEX ....

Or

maybe instead of JOIN you can use the command

MATCH FILE ....
etc

ON TABLE HOLD OLD-AND-NEW

if you use the GUI it will help you into the good direction.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
Alan it looks like your suggestion to group the 'BY' fields in the proper order has done the trick! I'm not sure why that didn't occur to me before. Probably b/c of the hierarchy sequence I tend to view my data in (open client, close client, partner, etc).

In case you're interested, I initially thought the same thing about no need for the JOIN, and tried something very similar to what you suggest here, but this won't work b/c I need the primary_submit value when cli_prod_id = 1 associated with every record regardless of the id.

MATCH was giving me similar problems, but it may work now using the same order logic.

I appreciate everyone's input!


WF 7.1.1 - RedHat Linux - Tomcat - SQL Server 2000
 
Posts: 12 | Location: Chicago, IL | Registered: January 05, 2007Report 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     Problem with FOCUS JOIN

Copyright © 1996-2020 Information Builders