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     [CLOSED] JOIN QUESTION

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] JOIN QUESTION
 Login/Join
 
Master
posted
Hi,

Please let me know the way to get the following result.

Table 1
--------
col1 col2
1 a
b
c
2 a
b
c
d

Table 2
--------
col2 col3
a aaaa
b bbbb
c cccc
d dddd
e eeee
f ffff
g gggg
h hhhh

Output
-------
col1 col2 col3
1 a aaaa
b bbbb
c cccc
d dddd
e eeee
f ffff
g gggg
h hhhh
2 a aaaa
b bbbb
c cccc
d dddd
e eeee
f ffff
g gggg
h hhhh

Thanks

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


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
You mean:
Table 1
--------
col1  col2
1      a
1      b
1      c
2      a
2      b
2      c
2      d

Table 2
--------
col2  col3
a     aaaa
b     bbbb
c     cccc
d     dddd
e     eeee
f     ffff
g     gggg
h     hhhh

Output
-------
col1 col2 col3
1    a    aaaa
     b    bbbb
     c    cccc
     d    dddd
     e    eeee
     f    ffff
     g    gggg
     h    hhhh
2    a    aaaa
     b    bbbb
     c    cccc
     d    dddd
     e    eeee
     f    ffff
     g    gggg
     h    hhhh


It's not clear how this output relates to these inputs. How are values f,g,h of col2 in Table 2 associated with either value (1,2) of col1 in Table 1? Do you just want to replicate all columns and rows of table2 for each distinct value of col1 in Table 1?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
YES, I want to replicate all columns and rows of table2 for each distinct value of col1 in Table1.


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
So you want a Cartesian product. One method is a "Conditional" join without conditions:
JOIN CLEAR *
SET HOLDLIST=PRINTONLY

-* set up two data sources without common fields
TABLE FILE CAR
BY COUNTRY
WHERE COUNTRY CONTAINS 'Y';
ON TABLE HOLD AS TABLE1 FORMAT FOCUS
END

TABLE FILE CAR
BY CAR BY MODEL BY RCOST 
WHERE COUNTRY OMITS 'Y';
ON TABLE HOLD AS TABLE2 FORMAT FOCUS
END

-* join and report
JOIN FILE TABLE1 AT E01 TO MULTIPLE FILE TABLE2 AT E01
END

TABLE FILE TABLE1
PRINT SEG.CAR
BY COUNTRY
ON TABLE SET ONLINE-FMT STANDARD
END  


Output:

 
NUMBER OF RECORDS IN TABLE=        2  LINES=      2 
NUMBER OF RECORDS IN TABLE=        7  LINES=      7 
NUMBER OF RECORDS IN TABLE=       14  LINES=     14

  
  
  COUNTRY     CAR               MODEL                     RETAIL_COST           
  -------     ---               -----                     -----------           
  ITALY       DATSUN            B210 2 DOOR AUTO                3,139
              JAGUAR            V12XKE AUTO                     8,878
              JAGUAR            XJ12L AUTO                     13,491
              JENSEN            INTERCEPTOR III                17,850
              PEUGEOT           504 4 DOOR                      5,610
              TOYOTA            COROLLA 4 DOOR DIX AUTO         3,339
              TRIUMPH           TR7                             5,100
  W GERMANY   DATSUN            B210 2 DOOR AUTO                3,139
              JAGUAR            V12XKE AUTO                     8,878
              JAGUAR            XJ12L AUTO                     13,491
              JENSEN            INTERCEPTOR III                17,850
              PEUGEOT           504 4 DOOR                      5,610
              TOYOTA            COROLLA 4 DOOR DIX AUTO         3,339
              TRIUMPH           TR7                             5,100
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
This is not working for me.

In your case, COUNTRY is in other table and doing the sort by COUNTRY will work but my case just CAR is in different table but after we join, I want to do the sort by COUNTRY.

something like this

TABLE FILE CAR
BY CAR
WHERE COUNTRY CONTAINS 'Y';
ON TABLE HOLD AS TABLE1 FORMAT FOCUS
END

TABLE FILE CAR
BY COUNTRY BY MODEL BY RCOST
WHERE COUNTRY OMITS 'Y';
ON TABLE HOLD AS TABLE2 FORMAT FOCUS
END

-* join and report
JOIN FILE TABLE1 AT E01 TO MULTIPLE FILE TABLE2 AT E01
END

TABLE FILE TABLE1
PRINT CAR MODEL RCOST
BY COUNTRY
ON TABLE SET ONLINE-FMT STANDARD
END


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
quote:
This is not working for me.

quote:
... my case just CAR is in different table but after we join, I want to do the sort by COUNTRY.


You could have provided all those particular details about your data from the very beginning when you posted your question, therefore reducing a lot of guesswork.

I honestly don't see how j.gross could have come up with such a good example given so limited specs ... perhaps I'm just becoming lazy Eeker

Anyway, it seems as if you already managed to envision a solution based on your last piece of code, didn't you?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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     [CLOSED] JOIN QUESTION

Copyright © 1996-2020 Information Builders