outer-join in browse or view

cecsno

Member
Does anyone know how to make an outer join in browse maintenance (36.20.13.10) or view maintenance (36.20.13.12).

tables = pt_mstr and lb_data (custom db).

Would like to display
Item Item UPC Customer UPC Selling UPC UCC 14
pt_part pt_upc lb_data08 lb_data09 lb_data10.

Would like to display all pt_mstr records even if lb_data record does not exist.
 

bendaluz2

Member
Dont know MFGPRO, so bear with me, but you just need to put the phrase "OUTER-JOIN" in the query on the reference to the buffer you want to do this to.

i.e. query was
<pre>
OPEN QUERY {&SELF-NAME}
FOR EACH pt_mstr
&lt;Query-Phrase&gt;
NO-LOCK,
FIRST lb_data
&lt;lb_data-Query-Phrase&gt;
NO-LOCK.
</pre>
Becomes:
<pre>
OPEN QUERY {&SELF-NAME}
FOR EACH pt_mstr
&lt;Query-Phrase&gt;
NO-LOCK,
FIRST lb_data
&lt;lb_data-Query-Phrase&gt;
OUTER-JOIN NO-LOCK.
</pre>
Note, all the field displayed from the lb_data table will display as ? when a record is not available. To stop this occuring, define a display variable for each field you want to display and name these in the display phrase instead of the real fields. Then change the ROW-DISPLAY trigger of the browse to something like:
<pre>
IF AVAILABLE lb_data THEN
ASSIGN tmp$lb_data08 = lb_data.lb_data08
tmp$lb_data09 = lb_data.lb_data09
tmp$lb_data10 = lb_data.lb_data10.
ELSE
ASSIGN tmp$lb_data08 = ""
tmp$lb_data09 = ""
tmp$lb_data10 = "".
</pre>
Or something more appropriate if the data types are different.
If the browse is a smart object, you will also need to create local-display-fields and comment/remove out the dispatch call to "display-fields".

HTH

Originally posted by cecsno
Does anyone know how to make an outer join in browse maintenance (36.20.13.10) or view maintenance (36.20.13.12).

tables = pt_mstr and lb_data (custom db).

Would like to display
Item Item UPC Customer UPC Selling UPC UCC 14
pt_part pt_upc lb_data08 lb_data09 lb_data10.

Would like to display all pt_mstr records even if lb_data record does not exist.
 
Top