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]how to do join using Match tools with two table have same field name?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]how to do join using Match tools with two table have same field name?
 Login/Join
 
Platinum Member
posted
Hi All

i am doing join between two synonym using match tools. the first table has Customer Name , Balance and Amount. the second table has also Customer Name, Balance and Amount. both table hold different values for the measures. the issue when i am doing Join using Match Tools to generate a Report with one dimension and 4 measures it seems that i am reading same fields of measures of first table in the Match request. it should gives me different values for the 4 measures. i.e

Table1
-----------
Customer Name | Balance | Amount
john | 10 | 50
Maria | 20 | 70

Table2
-----------
Customer Name | Balance | Amount
john | 40 | 30
Maria | 60 | 80


Doing the Match where Customer in the By section as joining key and Balance,Amount in the SUM section.generate the report from the HOLD as
BY Customer and print details all the 4 measures gives this result:

Customer Name | Balance | Amount | Balance | Amount
john | 10 | 50 | 10 | 50
Maria | 20 | 70 | 20 | 70

i am looking for the following results:

HOLD
-----------
Customer Name | Balance | Amount | Balance | Amount
john | 10 | 50 | 40 | 30
Maria | 20 | 70 | 60 | 80



i appreciate your help and guidance
Qalqili

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


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
 
Posts: 118 | Registered: February 08, 2006Report This Post
Gold member
posted Hide Post
From the looks of your examples would the MORE command work better for you?

 TABLE FILE Table1
PRINT 
BALANCE
AMOUNT
BY CUSTOMER 
-*Where statement for Table1 here
ON TABLE PCHOLD FORMAT HTML
MORE
FILE Table2
-*Where statement for Table2 here
END


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Virtuoso
posted Hide Post
Actually, it looks to me that a JOIN would be the way to go as you need to put matching records from both tables in the same row.

JOIN CUSTOMER IN TABLE1 TO ALL CUSTOMER IN TABLE2

TABLE FILE TABLE1
PRINT TABLE1.CUSTOMER
      TABLE1.BALANCE  AS 'BALANCE_1'
      TABLE1.AMOUNT   AS 'AMOUNT_1'
      TABLE2.BALANCE  AS 'BALANCE_2'
      TBALE2.AMOUNT   AS 'AMOUNT_2'
END



If you need all data from TABLE1 even when no matching records exist in TABLE2, then you'll need a LEFT OUTER JOIN there to help you.

Now, if you need any records from either TABLE1 or TABLE2 regardless of the existence of matching information in each other table then you will definitely need to use MATCH OLD-OR-NEW logic.



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
Gold member
posted Hide Post
In creating test data, I was able to get the desired results using the MATCH logic in the initial request:

  
TABLE FILE CAR
PRINT
COMPUTE CUST_NAME/A10 = ' ';
COMPUTE BALANCE/I5    = 0;
COMPUTE AMOUNT/I5     = 0;
BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
ON TABLE HOLD AS TABLE1 FORMAT ALPHA
END
-RUN
HOLD AS TABLE2 FORMAT ALPHA

-WRITE TABLE1 JOHN         10   50 
-WRITE TABLE1 MARIA        20   70 
-CLOSE TABLE1
-RUN

-WRITE TABLE2 JOHN         40   30 
-WRITE TABLE2 MARIA        60   80 
-CLOSE TABLE2
-RUN

MATCH FILE TABLE1
SUM
BALANCE
AMOUNT
BY CUST_NAME
RUN
FILE TABLE2
SUM
BALANCE
AMOUNT
BY CUST_NAME
AFTER MATCH HOLD AS TEST3 OLD-OR-NEW
END
-RUN

TABLE FILE TEST3
PRINT *
END
-RUN


  
CUST_NAME BALANCE AMOUNT BALANCE AMOUNT 
JOHN      10      50     40      30 
MARIA     20      70     60      80 


WF 7.6.10, Windows, PDF, Excel
 
Posts: 75 | Location: Dallas, TX | Registered: February 12, 2004Report This Post
Platinum Member
posted Hide Post
Hi Mary

your code works well , i wounder is there a technique to diffrentiate the Measures from each other. i.e if i want to make a compute to take the difference from first Amount and first Balance and another compute to take the difference from secound Amount and second Balance from table2.

Regards
Qalqili

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


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
 
Posts: 118 | Registered: February 08, 2006Report This Post
Virtuoso
posted Hide Post
Sure there is (use the AS-phrase):
MATCH FILE TABLE1
SUM
BALANCE AS BALANCE1
AMOUNT AS AMOUNT1
BY CUST_NAME
RUN
FILE TABLE2
SUM
BALANCE AS BALANCE2
AMOUNT AS AMOUNT2
BY CUST_NAME
AFTER MATCH HOLD AS TEST3 OLD-OR-NEW
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
thansk very much Gamp, mary and every body for your help and assistance


WF 7.7.0.3HF3 / WinXP- WF-Client & Apache / DevStd 7.7.0.3HF3 win XP.
 
Posts: 118 | Registered: February 08, 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]how to do join using Match tools with two table have same field name?

Copyright © 1996-2020 Information Builders