Match part of bo1.attribute1 and bo2.attribute2

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ninap
Posts: 186
Joined: Wed Mar 17, 2010 6:45 pm

Match part of bo1.attribute1 and bo2.attribute2

Post by ninap »

hi guys,

i have am trying to find and match 2 records based on only part of an attributes contents.

example:

I have 2 objects; Customers which has a relation to Contacts
Customers has an attribute called CompanyName (Customers.CompanyName)

Contacts may be added but not assigned to a customer at the time created and has an attribute Employer (Contacts.Employer)

So in essence we can have 100 contacts with different employers (Redbull,Jack Daniels) etc..
When we get a customer we want to find the contacts which were associated and "Insert" them.

Sometimes the name entered is like 'Jack Daniels The Whiskey Company' and not exactly a match 'Jack Daniels' so we need to figure out how to match these somehow.

Any ideas?

txs in advance, nina ;)
ninap
Posts: 186
Joined: Wed Mar 17, 2010 6:45 pm

Re: Match part of bo1.attribute1 and bo2.attribute2

Post by ninap »

to further describe the issue -

attribute 1 - could contain erroneous data from bad imports as example

attribute1=smirnov vokda company
attribute1=vokda-Smirnov-company
attribute1=Smirnov Vodka

STARTSWITH, ENDSWITH or CONTAINS require some ability to signify a wildcard or even if we could figure out the syntax format - we could write a rule which grabs ALL words before a SPACE or AFTER a delimiter it would help.

has anyone tried to do that?
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Match part of bo1.attribute1 and bo2.attribute2

Post by tford »

Check out the User Guide & search for "Text functions". WORD_NUMBER, WORDS_FROM_LEFT, WORDS_FROM_RIGHT might be useful to you.
Tom - V8.8 build 3137 - MySql / PostGres
ninap
Posts: 186
Joined: Wed Mar 17, 2010 6:45 pm

Re: Match part of bo1.attribute1 and bo2.attribute2

Post by ninap »

hi tom and thanks,

have invested about 8 hours into learning based on a couple of your's and others posts;

http://www.awareim.com/forum/viewtopic. ... 786#p24786

to learn more I found another fixed syntax which also is a task for me this week -

We have inbound email and I need to also write a matching rule so I need to strip chars from this FromAddress.

FromAddress: 'Firstname Lastname <[email protected]>'

Mission:
  • Remove everything before the <
    And remove the >

wrote this rule which is casusing issues gets it to this point [email protected]>

Just cannot remove the ">" from the text field... argh..

email_in.FromEmail=WORDS_FROM_RIGHT(email_in.FromAddress,1)
email_in.FromEmail=CHARS_FROM_RIGHT(email_in.FromEmail,LENGTH(email_in.FromEmail)-INDEX_OF('<',email_in.FromEmail))
email_in.FromEmail=CHARS_FROM_LEFT(email_in.FromEmail,LENGTH(email_in.FromEmail)-INDEX_OF('>',email_in.FromEmail))

What can I be doing wrong in this one ?

super txs, nina ;)
ninap
Posts: 186
Joined: Wed Mar 17, 2010 6:45 pm

SOLVED - Re: Match part of bo1.attribute1 and bo2.attribute2

Post by ninap »

finally - only hours of tinkering ;)

email_in.FromEmail=WORDS_FROM_RIGHT(email_in.FromAddress,1)
email_in.FromEmail=CHARS_FROM_LEFT(email_in.FromEmail,LENGTH(email_in.FromEmail)-INDEX_OF('<',email_in.FromEmail))
email_in.FromEmail=CHARS_FROM_RIGHT(email_in.FromEmail,LENGTH(email_in.FromEmail)-INDEX_OF('<',email_in.FromEmail))

results = email address based on IncommingEmail.FromAddress
Post Reply