Focal Point
Missing values in cross reference file

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

July 24, 2008, 05:23 PM
BobV
Missing values in cross reference file
I've searched for a possible solution, but cannot find.

I am joining two tables on ID. It's an outer join with ALL=ON. Because of this, all the fields in the cross reference table are also missing. Is there a way to plug a dummy value in for the missing values.

JOIN TABLE1.ID IN TABLE1 TO ALL TABLE2.ID IN TABLE2
END
DEFINE FILE TABLE1
NAME_MOD/A10 MISSING ON = IF TABLE2.NAME IS MISSING THEN '0' ELSE 'TABLE2.NAME';
END
TABLE FILE PRINT
PRINT
TABLE1.ID
NAME_MOD
END

Basically, I want a character value in NAME_MOD for every record regardless.

Thanks all.


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
July 24, 2008, 05:32 PM
PBrightwell
quote:
all the fields in the cross reference table are also missing


Are you saying that you are not coming up with values from TABLE2 or are they not what you expect them to be?

quote:
NAME_MOD/A10 MISSING ON = IF TABLE2.NAME IS MISSING THEN '0' ELSE 'TABLE2.NAME';


If NAME_MOD is a required field remove the MISSING ON and the quotes around 'TABLE2.NAME'

MATCH might serve you better in this case, try searching on it.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
July 24, 2008, 05:59 PM
BobV
The fields in Table2 are missing only where there is not a match between the two tables on ID.


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
July 25, 2008, 04:25 AM
hammo1j
There's a bit of subtlety required here.

If the target field you are joining to does not have MISSING=ON then a non matching value will retrieve blanks. (I personally always use the missing attribute on keys in an RDBMS for this reason).

DEFINE FILE TABLE1
NAME_MOD/A10 MISSING ON = IF TABLE2.NAME IS MISSING OR TABLE2.NAME EQ ' ' THEN '0' ELSE 'TABLE2.NAME';
END


Should do the trick.



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
July 28, 2008, 11:25 AM
Darin Lee
As Pat says, if you always want a value for the field NAME_MOD, there is no need for the "MISSING ON." That only means that the value of NAME_MOD could sometimes be missing - which is NOT what you asked for.

When you put TABLE2.NAME inside of tick marks, WF thinks you are setting the value of NAME_MOD to a literal (which in this case is 11 characters so it would give you an error anyway.) This should work.

NAME_MOD/A10=IF TABLE2.NAME IS MISSING THEN '0' ELSE TABLE2.NAME;

If TABLE2.NAME is blank you would also need to add OR TABLE2.NAME EQ ''.


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
July 29, 2008, 02:06 PM
RSquared
Bobv,

First of all you should use a left_outer join to make sure that all records from table1 are included even if there is no match on table2.
Hold the results in a hold file. You can then create a 'Define' field that will check for '' or missing.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit