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] MATCH question

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] MATCH question
 Login/Join
 
Platinum Member
posted
I have two tables that do not have a common field. Like this:

TABLE FILE CAR
PRINT COUNTRY
-*ON TABLE HOLD AS TABLE2
END
-*
TABLE FILE CAR
PRINT CAR
-*ON TABLE HOLD AS TABLE1
END

What I need is to merge these two together so that the finished table will have each country value will be repeated for each car. So you would have:

Country | Car
ENGLAND | JAGUAR
ENGLAND | JENSEN
ENGLAND | TRIUMPH
ENGLAND | PEUGOT
ENGLAND | ALPHA ROMEO
ENGLAND | MASERATI
ENGLAND | DATSUN
ENGLAND | TOYOTA
ENGLAND | AUDI
ENGLAND | BMW
FRANCE | JAGUAR
FRANCE | JENSEN
FRANCE | TRIUMPH
FRANCE | PEUGOT
FRANCE | ALPHA ROMEO
FRANCE | MASERATI
FRANCE | DATSUN
FRANCE | TOYOTA
FRANCE | AUDI
FRANCE | BMW
... so on and so forth.

Any WF code I can use? If not, any SQL code I can use?

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


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Expert
posted Hide Post
Try this, a variation of the "McGyver Technique":

TABLE FILE CAR
PRINT COUNTRY
COMPUTE DUMMY1/A1 = '';
ON TABLE HOLD AS H001 FORMAT FOCUS INDEX DUMMY1
END
-RUN

TABLE FILE CAR
PRINT CAR
COMPUTE DUMMY1/A1 = '';
ON TABLE HOLD AS H002 FORMAT FOCUS INDEX DUMMY1
END
-RUN

JOIN DUMMY1 IN H001 TO ALL DUMMY1 IN H002 AS J1

TABLE FILE H001
PRINT
COUNTRY
CAR
BY COUNTRY NOPRINT
BY CAR NOPRINT
END


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
Could you just do a cross join instead of a match?


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
 
Posts: 127 | Location: San Antonio | Registered: May 29, 2009Report This Post
Expert
posted Hide Post
A cross join is certainly more elegant, I've never done this before, but it works quite nicely:
SQL
SELECT 
C1.COUNTRY,
C2.CAR 
FROM CAR C1 
CROSS JOIN CAR C2
ORDER BY
C1.COUNTRY,
C2.CAR
END


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
Awesome!! Thank you so much!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Expert
posted Hide Post
I think that this does the same thing.

JOIN FILE CAR AT COUNTRY TAG C1 TO ALL 
     FILE CAR AT CAR     TAG C2 AS JC
END

TABLE FILE CAR
 PRINT C1.COUNTRY
       C2.CAR
END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
It's interesting that all above method only works when hold file is FORMAT FOCUS. If I didn't specify FORMAT FOCUS none of them works. The result either only takes the first row from left table to join all rows to the right, or only first row in both tables.


7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
 
Posts: 147 | Location: Toronto (GTA) | Registered: May 25, 2005Report This Post
Expert
posted Hide Post
The conditional JOIN can't use FOCUS files, they must be non FOCUS hold files.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report 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] MATCH question

Copyright © 1996-2020 Information Builders