Message Boards
How to search for unmatched records in a browse
Cathy Jeanes, modified 3 Years ago.
How to search for unmatched records in a browse
Post Date: 5/30/16 (Bronze, 6 Posts) Recent PostsI want to link 2 tables and return only the records from the 1st table that don't exist in the 2nd table.
An example - looking at all items that don't have a production line assigned to them.
I have created a browse with an outer join from the pt_mstr table to the Lnd_det table but I can't work out how to select records in pt_mstr that don't exist in lnd_det
Would welcome any ideas
thanks
Scott Dulecki, modified 10 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 5/31/16 (Silver, 29 Posts) Recent PostsFirst step... add this in the filter field on the query tab: pt_pm_code = "L" and pt_run_seq1 = "" <p>
That will show everything that is line sequenced with no Run Sequence 1.
That's not exactly what you're looking for... I suspect there's a creative way with local variables and preprocessors to do that, and if I figure it out, I'll share it with you.
Phill Norrey, modified 10 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 5/31/16 (Yoda, 1010 Posts) Recent PostsCathy Jeanes, modified 10 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 5/31/16 (Bronze, 6 Posts) Recent PostsXavier Pechadre, modified 10 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 6/1/16 (Silver, 70 Posts) Recent PostsPhill Norrey, modified 9 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 7/12/16 (Yoda, 1010 Posts) Recent PostsCathy. What you need to do is set up the part as the left table (ie the first table) then add the lnd_det as the second table.
Create the joins between the records and then RIGHT CLICK on one of the join lines and select properties.
At the bottom of the properties screen there is the option to include ALL records from the left table. Click on that option.
Then when you run your report it will show you a blank where there is a missing record.
BUT it will be slow depending upon how many records you have
Tomaz Ranzinger, modified 9 Years ago.
Re: How to search for unmatched records in a browse
Post Date: 7/13/16 (Silver, 77 Posts) Recent PostsCathy, in you case you need just ONE table in browse - that is pt_mstr.
And as Xavier said, add local-ariable and call function which returns lnd_line.
Here is function:
FUNCTION GetLndLine returns character (input partcode as character):
define variable returnValue as character no-undo.
define buffer pt_mstr for pt_mstr.
for first pt_mstr no-lock where
pt_domain = global_domain and pt_part = partcode:
for first lnd_det no-lock
where lnd_domain = pt_domain and
lnd_part = pt_part :
returnValue = lnd_part.
end.
end.
return returnValue.
end function.
And here is what you have to put in local-variable properties: GetLndLine (input pt_part).
Message place holder
Forums