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] JOIN ALL FROM TWO TABLES

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] JOIN ALL FROM TWO TABLES
 Login/Join
 
Member
posted
I want the result to have everything from two tables. I tied to use JOIN TO ALL but it did not bring the result.
For example:
TABLE A
KEY
1
1
1
2
2
2
5
5
5


TABLE B
KEY
1
2
5
6
7

Is it possible to have result from both:
1
1
1
2
2
2
5
5
5
6
6
6
7
7
7

I already have:
SET ALL = ON
SET ALL = PASS

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


WebFOCUS 7.6.4
Windows XP
Excel, PDF, HTML, txt,,,,,etc
 
Posts: 8 | Registered: January 28, 2010Report This Post
Platinum Member
posted Hide Post
Match logic will bring everything back regardless if there or not in the host file.
AFTER MATCH HOLD OLD-OR-NEW.


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows
 
Posts: 118 | Location: Livonia, MI | Registered: March 27, 2009Report This Post
Member
posted Hide Post
I tried MATCH but only got result like:
1
1
1
2
2
2
5
5
5

did not catch 6 or 7


WebFOCUS 7.6.4
Windows XP
Excel, PDF, HTML, txt,,,,,etc
 
Posts: 8 | Registered: January 28, 2010Report This Post
Expert
posted Hide Post
-* TABLEA.fex

-SET &ECHO='ALL';

SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
-RUN

FILEDEF TABLEA DISK tablea.txt
-RUN

-WRITE TABLEA 1 APPLE
-WRITE TABLEA 1 BANANA
-WRITE TABLEA 1 COCONUT
-WRITE TABLEA 2 ORANGE
-WRITE TABLEA 2 PINEAPPLE
-WRITE TABLEA 2 MANGO
-WRITE TABLEA 5 KIWI
-WRITE TABLEA 5 STRAWBERRY
-WRITE TABLEA 5 PEACH

FILEDEF MASTER DISK temp/tablea.mas
-RUN

-WRITE MASTER FILENAME=TABLEB, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=TABLEB, $
-WRITE MASTER FIELDNAME=KEY1 , ALIAS=KEY1 , USAGE=A01, ACTUAL=A01, $
-WRITE MASTER FIELDNAME=     , ALIAS=FIL1 , USAGE=A01, ACTUAL=A01, $
-WRITE MASTER FIELDNAME=FRUIT, ALIAS=FRUIT, USAGE=A10, ACTUAL=A10, $
-RUN
FILEDEF TABLEB DISK tableb.txt
-RUN

-WRITE TABLEB 1 TANGERINE
-WRITE TABLEB 2 MELON
-WRITE TABLEB 5 APRICOT
-WRITE TABLEB 6 GRAPE
-WRITE TABLEB 7 CANTELOUPE

FILEDEF MASTER DISK temp/tableb.mas
-RUN

-WRITE MASTER FILENAME=TABLEB, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=TABLEB, $
-WRITE MASTER FIELDNAME=KEY1 , ALIAS=KEY1 , USAGE=A01, ACTUAL=A01, $
-WRITE MASTER FIELDNAME=     , ALIAS=FIL1 , USAGE=A01, ACTUAL=A01, $
-WRITE MASTER FIELDNAME=FRUIT, ALIAS=FRUIT, USAGE=A10, ACTUAL=A10, $
-RUN

MATCH FILE TABLEA
PRINT
FIL1 NOPRINT
BY KEY1
BY FRUIT
RUN
FILE TABLEB
PRINT
FIL1 NOPRINT
BY KEY1
BY FRUIT
AFTER MATCH HOLD AS H001 OLD-OR-NEW
END
-RUN

TABLE FILE H001
PRINT
KEY1
FRUIT
END
-RUN


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Hi,

You can try joining like this:

-* Extract first table
TABLE FILE EMPDATA
BY PIN
ON TABLE HOLD AS EMPHOLD
END
-*
-* Extract 2nd table
DEFINE FILE EMPLOYEE
PIN/A9=EMP_ID;
END
TABLE FILE EMPLOYEE
BY PIN
ON TABLE HOLD AS EMPHOLD2
END
-*
-* Join them up
MATCH FILE EMPHOLD
  BY PIN
RUN
FILE EMPHOLD2
  BY PIN
AFTER MATCH HOLD OLD-OR-NEW
END
TABLE FILE HOLD
PRINT
     PIN
END


See if that works.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 2008Report This Post
Platinum Member
posted Hide Post
Can you please show us your code? Everyone here is using AFTER MATCH HOLD OLD-OR-NEW. You WILL get all the records in one file. Perhaps you are tabling it in a way that prevents you from seeing all the records? It is hard to know without seeing your code. Thank you.


Kathy Phillips
Web FOCUS 8.2.05.14, 8.1.05, 8.08, 8.0.7, 8.0.5,8.0.2m, 7.6.10,7.7.03
Windows
 
Posts: 118 | Location: Livonia, MI | Registered: March 27, 2009Report This Post
Member
posted Hide Post
Part of my codes are as followings:

..
TABLE FILE MASTERHOLD
SUM
COL_1/D15CBN
COL_2/D15CBN
COL_3/D15CBN
COL_4/D15CBN
COL_5/D15CBN
COL_6/D15CBN
COL_7/D15CBN
COL_8/D15CBN
COMPUTE COL_9/D15CBN = ( COL_2 + COL_3 + COL_4 + COL_5 + COL_6 + COL_7 + COL_8 ) ;
COMPUTE PRE_COL_9/D15CBN = ( COL_2 + COL_3 + COL_4 + COL_5 + COL_6 + COL_7 + COL_8 ) ;
BY FUND_CODE
BY ROW_NUM
WHERE REPORT_ID EQ 'R-10';
WHERE FUND_CODE FROM '10001' TO '10999';
ON TABLE HOLD AS PHOLD FORMAT ALPHA
END



TABLE FILE MASTERHOLD
SUM
COL_1/D15CBN
COL_2/D15CBN
COL_3/D15CBN
COL_4/D15CBN
COL_5/D15CBN
COL_6/D15CBN
COL_7/D15CBN
COL_8/D15CBN
COMPUTE COL_9/D15CBN = ( COL_2 + COL_3 + COL_4 + COL_5 + COL_6 + COL_7 + COL_8 ) ;
COMPUTE PRE_COL_9/D15CBN = ( PRE_COL_2 + PRE_COL_3 + PRE_COL_4 + PRE_COL_5 + PRE_COL_6 + PRE_COL_7 + PRE_COL_8 ) ;
BY FUND_CODE
BY ROW_NUM
WHERE REPORT_ID EQ 'R-10';
WHERE FUND_CODE FROM '10001' TO '10999';
ON TABLE HOLD AS CHOLD FORMAT ALPHA
END


TABLE FILE PHOLD
SUM
COL_1
COL_2
COL_3
COL_4
COL_5
COL_6
COL_7
COL_8
COL_9
PRE_COL_9
BY FUND_CODE
BY ROW_NUM
ON TABLE HOLD AS FINAL FORMAT ALPHA
MORE
FILE CHOLD
END

MATCH FILE FINAL
PRINT
COL_1
COL_2
COL_3
COL_4
COL_5
COL_6
COL_7
COL_8
COL_9
PRE_COL_9
BY FUND_CODE
BY ROW_NUM
RUN
FILE FD_INST_VW
PRINT
FUND_CODE
CITY
STATE
BY FUND_CODE
AFTER MATCH HOLD OLD-OR-NEW
END


TABLE FILE HOLD
PRINT
FUND_CODE
ROW_NUM
COL_1
COL_2
COL_3
COL_4
COL_5
COL_6
COL_7
COL_8
COL_9
PRE_COL_9
CITY
STATE
BY FUND_CODE NOPRINT
BY ROW_NUM NOPRINT
ON TABLE PCHOLD FORMAT EXL2K
END
-GOTO DONE

However, the result is like:

FUND ROW COL_1 COL_2 STATE CITY
100 1 $100 $200 TX DALLAS
100 2 $100 $200
100 3 $100 $200
200 0 0 CA IRVINE
300 0 0 FL MIAMI


But I want the result to be like:

FUND ROW COL_1 COL_2 STATE CITY
100 1 $100 $200 TX DALLAS
100 2 $100 $200 TX DALLAS
100 3 $100 $200 TX DALLAS
200 1 0 0 CA IRVINE
200 2 0 0 CA IRVINE
200 3 0 0 CA IRVINE
300 1 0 0 FL MIAMI
300 2 0 0 FL MIAMI
300 3 0 0 FL MIAMI

Is it possible to get it done like that?

Thanks for everyone's input.
 
Posts: 8 | Registered: January 28, 2010Report This Post
Expert
posted Hide Post
To get the state and city to repeat, change the PRINT in the second part of your MATCH FILE to SUM.

For the next part of your requirement, you will need to force the values of ROW_NUM that you want. So, in the TABLE FILE PHOLD, add a line after BY ROW_NUM to specify the ROWS that you need to have. e.g. ROWS 1 OVER 2 OVER 3

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
(1) change to SUM in Match - it works.
(2) change BY ROW to FOR ROW in PHOLD - it did not work well. However, I add DEFINE FILE afterwards to bring every ROW_NUM. Now everything works the way I want it.

Thank you very much.
 
Posts: 8 | Registered: January 28, 2010Report 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] JOIN ALL FROM TWO TABLES

Copyright © 1996-2020 Information Builders