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     How to generate a Cartesian Product

Read-Only Read-Only Topic
Go
Search
Notify
Tools
How to generate a Cartesian Product
 Login/Join
 
<Stahl>
posted
Hi, everybody

my question is:
is it possible to create a cartesian product out of two files each of them having one field. The fields don't have something in common.

E.g:
File1, Field1: A , B , C
File2, Field2: 99, 55

The resulting HOLD-file should contain 2 x 3 = 6 rows, and two fields.

HOLD:
Field1: A, Field2: 99
Field1: A, Field2: 55
Field1: B, Field2: 99
Field1: B, Field2: 55
Field1: C, Field2: 99
Field1: C, Field2: 55

All efforts using MATCH or JOIN didn't succeed.
Has anybody got a clue how to code in WebFOCUS?

Thanks for any advice!
Stahl
 
Report This Post
Platinum Member
posted Hide Post
See the following example using JOIN:


-* PFMIKPCR - FOCEXEC - 2004.04.07 - Mikel G�mez - Producto cartesiano.

-* _____________________________________________________________________
-* Test files generation for problem repro.

-* Test FILE 1.
TABLE FILE CAR
BY COUNTRY AS 'FIELD1'
ON TABLE HOLD AS FILE1
ON TABLE SET ASNAMES ON
END
-RUN

-* Test FILE 2.
TABLE FILE CAR
BY CAR AS 'FIELD2'
ON TABLE HOLD AS FILE2
ON TABLE SET ASNAMES ON
END
-RUN

-* _____________________________________________________________________
-* Objectives.

-* Now, we have:
-* FILE1, FIELD1: ENGLAND, FRANCE..., 5 values.
-* FILE2, FIELD2: ALFA, AUDI..., 10 values.
-*
-* And we need the cartesian product:
-* FILE3, 5 x 10 = 50 records.
-*
-* Steps:
-* 1. Create temp file of second file with common blank index.
-* 2. Join first and temp file using the common blank index using TO ALL.
-* 3. Create the cartesian product.

-* _____________________________________________________________________
-* Index second file with common blank index.

TABLE FILE FILE2
PRINT
COMPUTE KEY/A1 = ' ' ;
FIELD2
ON TABLE HOLD AS FILE2IND FORMAT FOCUS INDEX KEY
END
-RUN

-* _____________________________________________________________________
-* 2. Join files using common blank index. (*** TO ALL ***)

JOIN CLEAR *
JOIN KEY WITH FIELD1 IN FILE1 TO ALL KEY IN FILE2IND AS J1

-* _____________________________________________________________________
-* 3. Create and show cartesian product.

DEFINE FILE FILE1
KEY/A1 WITH FIELD1 = ' ' ;
END

TABLE FILE FILE1
PRINT
FIELD1
FIELD2
END
-RUN
I hope this helps.
Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<Stahl>
posted
Super trouper, Mikel! That was exactly what I needed.
Thanks a lot!
Stahl
 
Report This Post
Platinum Member
posted Hide Post
Have you tried the command..
SET CARTESIAN=ON
 
Posts: 226 | Registered: June 08, 2003Report This Post
<Stahl>
posted
Yes, I did, but it didn't work. Maybe I made a mistake
 
Report This Post
Platinum Member
posted Hide Post
SET CARTESIAN is not applicable in this case.
quote:
From SET CARTESIAN (Creating Reports With WebFOCUS Language)
SET CARTESIAN enables you to generate a report containing all combinations of non‑related records or data instances in a multi‑path request...
In this topic we haven't path. We have two unrelated files without any common field. We must create the path properly.

Regards,
Mikel
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report 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     How to generate a Cartesian Product

Copyright © 1996-2020 Information Builders