Focal Point
Using define fields to JOIN databases

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3971033262

December 19, 2007, 11:16 AM
Ronn
Using define fields to JOIN databases
Can one use a define field for a JOIN statement?
It's actually not as simple as that... here's what I mean.

DATABASE A:
-----------
CONTRACT A8
ITEMDESC A15
QTY I5

DATABASE B:
-----------
CONTKEY A11
DELVADDR1 A20
DELVADDR2 A20

DEFINE FILE B
CONTKEY8/A8 EDIT(CONTKEY,'99999999$$$');

I want to join A and B via CONTRACT and CONTKEY because the first 8 chars of CONTKEY is the contract.
When I executed the join after the DEFINE stmt, I got...
(FOC370) THE FIELDNAME USED IN JOIN CANNOT BE FOUND IN THE FILE

Thanks in advance for any help!


Thanks,
Ronnel C
WebFocus 7.1.5
IBM ZOS 1.6
December 19, 2007, 11:34 AM
hammo1j
JOIN CONTKEY8 WITH CONTKEY ...

Should do the job.

The with tells you where the define is located within a multi segment structure although this should not be strictly necessary since wf can tell where a define field is logically related unless it is a constant.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
December 19, 2007, 11:45 AM
Francis Mariani
Don't forget that that contrary to intuition, the DEFINE goes after the JOIN.


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
December 19, 2007, 11:46 AM
GinnyJakes
And the JOIN goes before the DEFINE. This is a well-documented feature. Look for define-based joins.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
December 19, 2007, 12:47 PM
Darin Lee
Some databases allow the join to the first part of a key without having to do a define. Can't tell what DB you are using, though.

One other note - with your defined field you would have to join B to A. Joining A to B would not work. You can't join a real field in A TO a defined field in B, but you can join FROM a defined field in B to a real field in A.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
December 19, 2007, 01:18 PM
FrankDutch
What would be the result if you change the USAGE value of this field in the master?
If the real value in the Database B should be A8 then that would be an other solution. (In fact a correction on the database design)




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7