Selecting from one DB to another

A zillion years ago someone showed me Pan code that could select items in one DB based on a list of items in another DB. I can’t find the code and it would save me mucho time to have it again. I only remember it was dead easy and had (I think) “<>” in it–which doesn’t get me very far!
Thanks in advance!

I think we need a more precise description of what you are trying to accomplish, before anyone can give a precise answer. In general, you would probably create the list using listchoices( or arraybuild(. The select would use arraycontains( or arraynotcontains(, depending on whether you are looking for values that are, or are not on the list.

Hi Dave. Thanks. I think it was some sort of formula find procedure but it’s been years.

So DB_1 has a field named ItemID
It contains numbers like
234
235
236
237

DB_2 also has a field named ItemID
It contains a much longer list of numbers, but includes the numbers in DB_1

I want a procedure to select in DB_2 numbers which match those in DB_1

Hope this is clearer. Thanks.

While there are (as always) multiple ways to do it, I agree with Dave. ArrayContains is likely to be the best choice.

With DB_2 as the active database, and DB_1 open in the background or in secret, you could do this.

let theList = arraydeduplicate(arraybuild(¶,"DB_1","ItemID"),¶)
select arraycontains(theList,ItemID,¶)

I found the old procedure which I modified to work:

select
lookupselected(“TempToFix”,«ItemID»,«ItemID»,«ItemID»,“”,0)
<> “”

The most amazing part of this is the feature in PAN that lets one search through ALL databases. (Thanks, Jim!) I hunted for “<>” and found a copy of old databases that still contained this lookup. Whew! Good thing I don’t clean house in my PAN folder as often as I should.

Thanks again to James and Dave – you guys have put up with me for decades now. Such patience! (I’ll see if I can get your code to work too–it’s fancier than the old procedure and now that I’m an antique, that matters.)

Should be a lot quicker too, especially if the DBs are large. And if they are, setting up a relationship will make it even speedier.

Panorama has changed a lot from a zillion years ago. It’s 2024, and Panorama has a built in feature to do what you want to do in a super fast way.

Using this feature is likely to be orders of magnitude faster than any of the techniques mentioned so far in this thread.