Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Joining 2 Tables on Fields that are only partially similar


This topic is 2992 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I have a PRODUCTS Table (1000 rows) containing a field called NAME.
I also have an ATTRIBUTES Table (20,000 rows) with useful attribute info (in 3 fields e.g. F1, F2, F3) that I want in my PRODUCTS table layout (for export to Excel).

I can't see an easy way to join the 2 tables.

ATTRIBUTES::MOD_NAME is never exactly the same as PRODUCTS::NAME.
ATTRIBUTES::MOD_NAME is a string that is sometimes partially contained in the string that is PRODUCTS::NAME.  This will be true zero, one or a few times.

ATTRIBUTES::MOD_NAME is contained in one or more of the PRODUCTS::NAME -- that's the "join" I want to do (based on a calculation/function e.g. StrMatch from https://www.briandunning.com/cf/257 or similar.) 

How do I do this "join"?  Or is there a better way to do what I am looking for? Thanks.

Edited by fm8443
Posted (edited)
41 minutes ago, fm8443 said:

I can't see an easy way to join the 2 tables.

There isn't.

If your data is static, I suggest you clean it up. For each attribute, find the product (or can it be products?) that contains its name and store its ID in a match field in the Attribute table. Instead of a find, you could also use the ExecuteSQL() function with the LIKE operator. But you cannot use a calculation field, because it would have to be unstored, and therefore unusable as a matchfield.

 

Edited by comment
Posted (edited)

The same ATTRIBUTES::F1 etc. may actually match a few of the PRODUCTS::NAME rows.

(I may be able to add a field to PRODUCTS that calculates a string that can actually be matched to the ATTRIBUTES table).

Edited by fm8443

This topic is 2992 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.