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] Join two unlike tables together

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Join two unlike tables together
 Login/Join
 
Silver Member
posted
Ive done some searching but can't seem to fine exactly what I'm looking for.

What I'm trying to do is create a hierarchy table of our store locations and our calendar. There are no matching keys in the files to create a join. I've tried creating a dummy field, and that works if I only had 1 store.

So what I need is a file that list all my stores (70 currently) with a calendar file - so my file in the end would list each store 365 times to represent each day of the year.

Does any one know if this is possible?

Any help would be a appreciated.

Thanks.

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


WEBFOCUS 7.14
WEBFOCUS.8.04
 
Posts: 44 | Registered: March 30, 2007Report This Post
Guru
posted Hide Post
How did you build your join when you tested with the dummy field, are you working with FOCUS files or database?

Perhaphs:

JOIN FIELD IN TABLE TO ALL FIELD IN ANOTHER_TABLE

Could help with FOCUS files


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Expert
posted Hide Post
-SET &ECHO=ON;

-*-- Create the master for CALENDAR1 -----------------------------
FILEDEF DATAMAST DISK CALENDAR1.MAS
-RUN

-*--
-WRITE DATAMAST FILE=CALENDAR1, SUFFIX=FIX, $
-WRITE DATAMAST SEGNAME=SEG1, SEGTYPE=S0, $
-WRITE DATAMAST FIELD=DATE1, ALIAS=DATE1, USAGE=YYMD, ACTUAL=A8, $

-*-- Create the data file for CALENDAR1 --------------------------
FILEDEF CALENDAR1 DISK CALENDAR1.FTM
-RUN

-WRITE CALENDAR1 20081124
-WRITE CALENDAR1 20081125
-WRITE CALENDAR1 20081126
-WRITE CALENDAR1 20081127
-WRITE CALENDAR1 20081128
-WRITE CALENDAR1 20081129
-WRITE CALENDAR1 20081130

-*-- Create the report -----------------------------------------------

DEFINE FILE CALENDAR1
CAL_DUMMY1/A1 = '';
END
-RUN

TABLE FILE CALENDAR1
PRINT DATE1
BY CAL_DUMMY1
ON TABLE HOLD AS HCAL FORMAT FOCUS INDEX CAL_DUMMY1
END
-RUN

JOIN CAR_DUMMY1 WITH COUNTRY IN CAR TO ALL CAL_DUMMY1 IN HCAL AS J1

DEFINE FILE CAR
CAR_DUMMY1/A1 WITH COUNTRY = '';
END
-RUN

TABLE FILE CAR
PRINT
DATE1 NOPRINT
BY COUNTRY
BY DATE1
END
-RUN

Depending on the type of tables you're joining, you MAY not need to create a temporary HOLD FORMAT FOCUS file...


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
Master
posted Hide Post
If the join doesn't work for you, you can apply the same dummy field logic and do a MATCH.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Cathy,

You say "create a hierarchy table of our store locations and our calendar". I understand that you have 2 tables. Evidently you cannot join them for lack of a common field. In fact you want to add 365 dates to your store table.
This is very similar to the McGuyver technique (you can look it up in the forum) and it is what Francis is proposing to you.

Here is an example of the Master for a McGuyver file:
  
FILENAME=FSEQ,SUFFIX=FIX
 SEGNAME=CHAR1,SEGTYPE=S0
  FIELDNAME=BLANK,BLANK,A1,A1,$
SEGNAME=CHARS,SEGTYPE=S0,PARENT=CHAR1,OCCURS=VARIABLE
  FIELDNAME=CHAR,CHARS,A1,A1,$
  FIELDNAME=COUNTER,ORDER,I2,I4,$

and of the data:
  
 FILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVERFILEFORMCGUYVER


Notice:
1. the data file MUST start with a space
2. the COUNTER field with is ALIAS=ORDER is an internal field which holds the occurence number of each character.
3. if you need a whole year just make the string 365 characters long

You could then code something like this:
  
-DEFAULT &STARTDATE='01/01/2008';
FILEDEF FSEQ DISK [i]path for file[/i]FSEQ.DAT

JOIN BLANK WITH COUNTRY IN CAR TO BLANK IN FSEQ AS X

DEFINE FILE CAR
BLANK/A1 WITH COUNTRY=' ';
STARTDATE/DMYY='&STARTDATE';
MDATE/DMYY=STARTDATE + COUNTER - 1;
END
TABLE FILE CAR
PRINT MDATE
BY COUNTRY
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
make a calendar file , 2 segments, the first is dummy.
make a storelist file, 2 segments, the first segment is dummy
SET CARTESIAN=ON
JOIN dummy IN CALENDAR TO dummy IN STORE AS J1
TABLE FILE thing
PRINT MONTH BY STORE
ON TABLE HOLD
END
SET CARTESIAN=OFF
..
where calendar is (if you don't want to create it from thin air with FSEQ , MacGyver)
DEFINE FILE something
dummy/A1 WITH somefield = '';
END
TABLE FILE something
SUM dummy NOPRINT BY dummy
SUM MONTH BY dummy
ON TABLE HOLD AS CALENDAR FORMAT FOCUS INDEX dummy
END
and your store file is.
..
TABLE FILE source
SUM dummy NOPRINT BY dummy
SUM STORENAME STORENUMBER etc BY dummy
ON TABLE HOLD AS STORE FORMAT FOCUS INDEX dummy
END
..




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Silver Member
posted Hide Post
Sorry for the late response - but this did work like a charm. Thanks so much for your help!


WEBFOCUS 7.14
WEBFOCUS.8.04
 
Posts: 44 | Registered: March 30, 2007Report 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] Join two unlike tables together

Copyright © 1996-2020 Information Builders