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.
I’m having trouble joining two hold files together. The problem lies in that the unique identifier I want to join on is a composite of two fields, for example’s sake, let’s call them EmpNumber and Company. EmpNumber is unique within a Company, but multiple companies can have the same EmpNumber. So, here’s a brief and oversimplified version of what I’ve got to do:
TABLE FILE TABLEA PRINT Customer EmpNumber DATAA ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS HOLDA FORMAT FOCUS INDEX EmpNumber Customer END
TABLE FILE TABLEB PRINT Customer EmpNumber DATAB ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS HOLDA FORMAT FOCUS INDEX EmpNumber Customer END
JOIN LEFT_OUTER FILE HOLDA AT HOLDA.SEG01.EmpNumber TO UNIQUE FILE HOLDB AT HOLDB.SEG01.EmpNumber TAG J0 AS J0 END
ON TABLE SET BYDISPLAY ON ON TABLE PCHOLD FORMAT HTML ON TABLE NOTOTAL ON TABLE SET PAGE-NUM OFF ON TABLE SET HTMLCSS ON END
What I'm having a hard time doing is making the join be on both EmpNumber and Client. From reading the documentation, it suggests that one can AND join fields together. So, I've tried the equivalent of:
JOIN LEFT_OUTER FILE HOLDA AT HOLDA.SEG01.EmpNumber AND HOLDA.SEG01.Customer TO UNIQUE FILE HOLDB AT HOLDB.SEG01.EmpNumber AND HOLDB.SEG01.Customer TAG J0 AS J0 END
But it just errors out. Has anyone else out there been in a similar situation and come up with a good solution? Ideas would be appreciated... I have tried a "Where" based join, but it runs at least 20 times slower, so that's not really an option.
When joining FOCUS files, the host does not need to have an INDEX, only the x-referenced file. Also a join to a FOCUS file can only be to ONE field, unlike SQL based data. The host file can use up to 4 fields (I think) to JOIN to the x-referenced file. The following is roughly what I think you are after. (Being old school I prefer the old style join syntax...)
TABLE FILE TABLEA
PRINT
Customer
EmpNumber
DATAA
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS HOLDA FORMAT FOCUS
END
TABLE FILE TABLEB
PRINT
DATAB
COMPUTE LINK/Ann = Customer | EmpNumber;
BY Customer
BY EmpNumber
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS HOLDB FORMAT FOCUS INDEX LINK
END
JOIN
Customer and EmpNumber IN HOLDA TAG A
TO LINK IN HOLDB TAG B AS J0
END
TABLE FILE HOLDA
PRINT
A.Customer
A.EmpNumber
A.DATAA
B.DATAB
ON TABLE SET BYDISPLAY ON
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM OFF
ON TABLE SET HTMLCSS ON
END
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
JOIN
Customer IN HOLDA TAG A
TO ALL Customer IN HOLDB TAG B AS J0
END
TABLE FILE HOLDA
PRINT
A.Customer
A.EmpNumber
A.DATAA
B.DATAB
WHERE A.EmpNumber EQ B.EmpNumber;
END
In this case you have to have the ALL (1-n relation) in the join, the WHERE will filter out unequal records.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Thanks everyone for the suggestions. The error was related to the rule Alan mentioned that FOCUS won't allow joins on 2 fields. I've done a lot of SQL, so I guess I took that for granted... Anyways, taking that option off the table, I've used the input to craft a solution that works for me (all 3 suggestions do in fact work). In the report(s) I've actually got, I've got a few more hold files involved. Also, Customer and EmpNumber are both whole numbers, and the max allowable value on Customer is 99999. Since most systems are most efficient at comparing numbers, I've tried this approach:
TABLE FILE TABLEA PRINT Customer EmpNumber DATAA COMPUTE CliEmp/P26 = (EmpNumber * 100000) + Customer; NOPRINT ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS HOLDA FORMAT FOCUS INDEX CliEmp END
TABLE FILE TABLEB PRINT Customer EmpNumber DATAB COMPUTE CliEmp/P26 = (EmpNumber * 100000) + Customer; NOPRINT ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS HOLDA FORMAT FOCUS INDEX CliEmp END
JOIN LEFT_OUTER HOLDA.SEG01.CliEmp IN HOLDA TO UNIQUE HOLDB.SEG01.CliEmp IN HOLDB TAG J0 AS J0 END
ON TABLE SET BYDISPLAY ON ON TABLE PCHOLD FORMAT HTML ON TABLE NOTOTAL ON TABLE SET PAGE-NUM OFF ON TABLE SET HTMLCSS ON END
I've still got to run it through the performance analyzer, and I'll compare the results with the other 3 approaches suggested to find the one that will scale best for me.
Again, thanks everyone for putting me on the path to solving this. Your input, as always, is invaluable.This message has been edited. Last edited by: Byrnsy,