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] Comparison Problem

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Comparison Problem
 Login/Join
 
Gold member
posted
Hi,

I am having a small problem regarding arranging of different data from two different tables.

For example:

There are two tables Employee and Car
I want to extract out all the information of the cars owned by an employee. I want them to be clubbed together in the report

The output should be like below

Owners Information
Name, Emp No, Designation
Sam D’zouza, 100, Manager

Car Information
Model, Vehicle Number
Chevrolet, 1234
Audi, 5676
Ferrari, 6666

Owners Information
Name, Emp No, Designation
Tom Brown, 101, Sr. Engineer

Car Information
Model, Vehicle Number
Audi, 5555


And so on….

I am stuck on how to compare the employee name associated with each car.

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


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report This Post
Platinum Member
posted Hide Post
Use subheadings for your displays.
JOIN EMP_NUMBER IN EMPLOYEE TO ALL EMP_NUMBER IN CAR
TABLE FILE EMPLOYEE
PRINT MODEL AS ''
VEHICLE_NUMBER AS ''
BY EMPL_NUMBER NOPRINT SUBHEAD
"Employee Information"
", , BY MODEL NOPRINT SUBHEAD
"Car Information"
"Model Vehicle Number"
END

You can then use your style sheet to assign fonts etc.
 
Posts: 140 | Location: Adelaide South Australia | Registered: October 27, 2006Report This Post
Guru
posted Hide Post
Swap,

Do you have the relationship between the employee# & vehicle# or something else to tie the owner and car together?


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Gold member
posted Hide Post
quote:
Originally posted by Hua:
Do you have the relationship between the employee# & vehicle# or something else to tie the owner and car together?


Yes infact, I do have a relationship between these two tables. I am joining it by Ids.

I tried to implement this by using MATCH function, but the ID is not matching up properly.

The match result is coming something like below

Emp Name Emp Id Car Name Emp Id
Jim 100 Mitsubishi 100
. 0 Lancer 100
. 0 Audi 100


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report This Post
Gold member
posted Hide Post
you can see my problem,

the Match is assingning 0 value to the Emp Id field of the first table whereas I want it to be 100.


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report This Post
Expert
posted Hide Post
Are you using PRINT or SUM in the first part of the MATCH?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
As it's Christmas, let me show you what I mean by the previous post.

First let us build some sample data. Jim likes trucks whilst Tim is into heavy armour -
EX -LINES 5 EDAPUT MASTER,SW_EMPFILE,CF,MEM
FILENAME=SW_EMPFILE, SUFFIX=FOC
SEGMENT=SEG01, SEGTYPE=S1, $
FIELDNAME=EMP_NO,   ALIAS=F01, USAGE=I3,  FIELDTYPE=I, $
FIELDNAME=EMP_NAME, ALIAS=F02, USAGE=A10, MISSING=ON, $

CREATE FILE SW_EMPFILE
MODIFY FILE SW_EMPFILE
FREEFORM EMP_NO EMP_NAME
DATA
100,JIM,$
200,TIM,$
END

EX -LINES 6 EDAPUT MASTER,SW_CARFILE,CF,MEM
FILENAME=SW_CAPFILE, SUFFIX=FOC
SEGMENT=SEG01, SEGTYPE=S1, $
FIELDNAME=EMP_NO,   ALIAS=F01, USAGE=I3,  FIELDTYPE=I, $
SEGMENT=SEG02, PARENT=SEG01, $
FIELDNAME=CAR_MAKE, ALIAS=F02, USAGE=A30, MISSING=ON, $

CREATE FILE SW_CARFILE
MODIFY FILE SW_CARFILE
FREEFORM EMP_NO CAR_MAKE
DATA
100,FORD,$
100,NISSAN,$
100,DODGE,$
200,ABRAHAM,$
200,SHERMAN,$
200,CHALLENGER,$
END


Now build a report using MATCH. Run this as is to begin with and then change the first PRINT to SUM instead and see the resultant output.
MATCH FILE SW_EMPFILE
PRINT EMP_NAME
-*  SUM EMP_NAME
   BY EMP_NO
RUN
FILE SW_CARFILE
PRINT CAR_MAKE
   BY EMP_NO
AFTER MATCH HOLD OLD
END

TABLE FILE HOLD
PRINT EMP_NAME
      CAR_MAKE
   BY EMP_NO
END


Now see how you can do the same with a join and therefore handle the data only once.
JOIN CLEAR *
JOIN EMP_NO IN SW_EMPFILE TO MULTIPLE EMP_NO IN SW_CARFILE AS J1

TABLE FILE SW_EMPFILE
PRINT EMP_NAME
      CAR_MAKE
   BY EMP_NO
END


I'll leave you to take Hua's suggestion on board for formatting.

Seasons greetings!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
yes

its like

MATCH FILE EMP
PRINT *
BY EMP_ID NOPRINT
RUN
FILE CAR
PRINT *
BY EMP_ID NOPRINT
AFTER MATCH HOLD OLD-OR-NEW
ON TABLE HOLD AS H4
END


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report This Post
Gold member
posted Hide Post
Also I want to process the input Data by Data i.e. Row by Row for my formatting to be correct


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report This Post
Expert
posted Hide Post
I think that I'll wait until you read the second part Wink

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
You are all making it way more complicated than youe need to. Why use a MATCH when you can use a one to many join.
Apart from the small typo the code I suggested should do the job.
Have you tried it (with appropriate changes to column names etc?

This line
", , BY MODEL NOPRINT SUBHEAD
should be
BY MODEL NOPRINT SUBHEAD

You do not need to use MATCH.
 
Posts: 140 | Location: Adelaide South Australia | Registered: October 27, 2006Report This Post
Gold member
posted Hide Post
I'll be trying your's and Tony's Suggestion suggestions and keep you posted. I am right now engaged in some other work.


Webfocus 7.7.03
Windows XP
Excel, PDF, HTML, APDF, AHTML, Maintain
 
Posts: 59 | Registered: July 22, 2009Report 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] Comparison Problem

Copyright © 1996-2020 Information Builders