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] Issue when using MATCH

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Issue when using MATCH
 Login/Join
 
Platinum Member
posted
I have this issue when using MATCH to combine records:
  
MATCH FILE HOLDA
PRINT FIELDA
BY FIELDB
BY FIELDC
RUN
FILE HOLDB
PRINT FIELDA
BY FIELDB
BY FIELDC
RUN
AFTER MATCH HOLD AS HOLD_TEMP_RT OLD-OR-NEW
Then, the output I got is :
FIELDB  FIELDC  FIELDA
BBB     CCC
BBB     CCC
BBB     CCC     AAA

This meant I just got 1 value of Field A although I have values of this field for all records. If I change PRINT FIELDA to BY FIELDA, it displays all but it will sort FIELDA, I don't want FIELDA is sorted, anyone have solution for this ? I also tried SUM FIELDA but it didn't work.
Thanks in advance.


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


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report This Post
Virtuoso
posted Hide Post
quote:
OLD-OR-NEW


Not knowing your data...play with above

try OLD-AND-NEW
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
quote:

Let me edit my example code as following:
MATCH FILE HOLDA
PRINT FIELDA1
BY FIELDB1
BY FIELDC1
RUN
FILE HOLDB
PRINT FIELDA2
BY FIELDB2
BY FIELDC2
AFTER MATCH HOLD AS HOLD_TEMP_RT OLD-OR-NEW
END
Then, the output I got is :
FIELDB FIELDC FIELDA
B1B1B1 C1C1C1
B2B2B2 C2C2C2
B3B3B3 C3C3C3 A3A3A3

It supposes to have value A1A1A1 in the first record and A2A2A2 in the second record but if I use PRINT in FIELDA1 and FIELDA2, it doesn't show up those data. And I need to use OLD-OR-NEW because data in these HOLD files is different.

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


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report This Post
Expert
posted Hide Post
Can you post the source records ?


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
Virtuoso
posted Hide Post
I am surprised you got anything. There should not be a RUN before the AFTER MATCH HOLD, and there should be an END after.

Can we see the actual code?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
I think:

MATCH FILE HOLDA
SUM FIELDA
BY FIELDB
BY FIELDC
RUN
FILE HOLDB
SUM FIELDA
BY FIELDB
BY FIELDC
AFTER MATCH HOLD AS HOLD_TEMP OLD-OR-NEW
END


Or perhaps SUM ALL.FIELDA

try it.

Good luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Virtuoso
posted Hide Post
MATCH is a strange beast, but as far as I understand, your initial example would result in a file containing:
FIELDB
FIELDC
FIELDA
FIELDA

Meaning that there are TWO fields in the result named FIELDA. Perhaps you're just not printing the correct one?
You can check that using ?FF HOLD_TEMP_RT

If that's your issue, does this fare better?
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY

MATCH
FILE HOLDA
PRINT FIELDA AS FIELDAA
BY FIELDB
BY FIELDC
RUN
FILE HOLDB
PRINT FIELDA AS FIELDBA
BY FIELDB
BY FIELDC
AFTER MATCH HOLD AS HOLD_TEMP_RT OLD-OR-NEW
END
-RUN

TABLE FILE HOLD_TEMP_RT
PRINT COMPUTE FIELDA/??? = IF FIELDAA IS MISSING THEN FIELDBA ELSE FIELDAA;
BY FIELDB
BY FIELDC
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Platinum Member
posted Hide Post
Using PRINT as the verb in the first part of a MATCH file simply isn't a good idea!

Along the same thought process as @Wep5622's post:

What do you want your output to be?
Because if you weren't expecting to see _two_ FIELDA columns, then perhaps MATCH FILE isn't what you want to use.

If you wanted all HOLDA records, followed by all HOLDB records, then perhaps you need to use "MORE" e.g.

TABLE FILE HOLDA
PRINT FIELDA
BY FIELDB
BY FIELDC
MORE
FILE HOLDB
ON TABLE HOLD AS HOLD_TEMP_RT
END


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008Report This Post
Platinum Member
posted Hide Post
Waz: My code is the mess now so that's why I use the sample code.
j.gross: Sorry, I mistyped it. I changed it.
Dave/Wep5622/Twanette: Thanks for your suggestion but they seem didn't work in my case. Please let me explain more detail my report. I need to get TDLine in READ_TEXT function so I need to pass some parameters to this function. I used the loop to pass each set of values for parameters each time to get TDLine, then I use MATCH to merge these records and save them to 1 Hold file. Then I just need to print this HOLD file to get the complete report. The issue I got is for 1 set of values, in my sample code, I get 1 line of FIELDB, one line of FIELDC but many lines of FIELDA and these lines need to be kept in the original order ( I can't sort them). I tried to use MATCH and I got the issue as I mentioned above. I can't get full FIELDA for all set of values or if I use BY for FIELDA, this field will be sorted and this will be wrong. I think I am so close with the solution but it seems I never touch it.


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report This Post
Expert
posted Hide Post
quote:
My code is the mess now so that's why I use the sample code


I was asking for the source data for the two tables.

Understanding this helps in getting the code right.


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
My code is almost like below except I used the loop statement to pass data to TDNAME, LText is the field I want to get from READ_TEXT.

 
MATCH FILE HOLDA
     BY HOLDA.HOLDA.EINA_MATNR AS 'MATNR'
     BY HOLDA.HOLDA.EINA_INFNR AS 'INFNR'
     BY HOLDA.HOLDA.EINA_LIFNR AS 'LIFNR'
     BY	J3.LINES.LINES_TDLINE AS 'LTEXT'
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '1111' );
RUN
FILE HOLDA
     BY HOLDA.HOLDA.EINA_MATNR AS 'MATNR'
     BY HOLDA.HOLDA.EINA_INFNR AS 'INFNR'
     BY HOLDA.HOLDA.EINA_LIFNR AS 'LIFNR'
     BY	J3.LINES.LINES_TDLINE AS 'LTEXT'
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '2222' );
AFTER MATCH HOLD AS HOLD_MAT_RT OLD-OR-NEW
END
RUN
TABLE FILE HOLD_MAT_RT 
	 BY MATNR 
	 BY INFNR 
	 BY LIFNR 
	 BY LTEXT 
ON TABLE PCHOLD FORMAT HTML
 

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


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report This Post
Expert
posted Hide Post
quote:
data for the two tables


Either sample or real


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
This is real.


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report This Post
Platinum Member
posted Hide Post
Hi,

Based on what you want to do, I still don't think you should be using MATCH FILE.

quote:
I use MATCH to merge these records and save them to 1 Hold file. Then I just need to print this HOLD file to get the complete report.


Based on the code you sent, try this:

TABLE FILE HOLDA
PRINT J3.LINES.LINES_TDLINE AS 'LTEXT'
     BY HOLDA.HOLDA.EINA_MATNR AS 'MATNR'
     BY HOLDA.HOLDA.EINA_INFNR AS 'INFNR'
     BY HOLDA.HOLDA.EINA_LIFNR AS 'LIFNR'
     BY	J3.LINES.LINES_TDLINE AS 'LTEXT'
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '1111' );
MORE
FILE HOLDA
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '2222' );
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS HOLD_MAT_RT  
END
 
TABLE FILE HOLD_MAT_RT 
PRINT LTEXT
	 BY MATNR 
	 BY INFNR 
	 BY LIFNR 
	 BY LTEXT 
ON TABLE PCHOLD FORMAT HTML
END


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008Report This Post
Platinum Member
posted Hide Post
Thanks Twanette. This totally works in my case. Just wanna change your code a little bit. ON TABLE should be at the first table. Look like all my issues are solved just by MORE.
  

TABLE FILE HOLDA
PRINT J3.LINES.LINES_TDLINE AS 'LTEXT'
     BY HOLDA.HOLDA.EINA_MATNR AS 'MATNR'
     BY HOLDA.HOLDA.EINA_INFNR AS 'INFNR'
     BY HOLDA.HOLDA.EINA_LIFNR AS 'LIFNR'
     BY	J3.LINES.LINES_TDLINE AS 'LTEXT'
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '1111' );
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS HOLD_MAT_RT  
MORE
FILE HOLDA
WHERE (J3.READ_TEXT.HEADER_TDID EQ 'BT') AND ( J3.READ_TEXT.HEADER_TDOBJECT EQ 'EINE' ) AND ( J3.READ_TEXT.HEADER_TDSPRAS EQ 'E' ) AND ( J3.READ_TEXT.HEADER_TDNAME EQ '2222' );

END
 
TABLE FILE HOLD_MAT_RT 
PRINT LTEXT
	 BY MATNR 
	 BY INFNR 
	 BY LIFNR 
	 BY LTEXT 
ON TABLE PCHOLD FORMAT HTML
END


WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 125 | Registered: June 17, 2013Report 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] Issue when using MATCH

Copyright © 1996-2020 Information Builders