First of all. I'd change the NameTran columns to V(40) and V(40). After the change, just issue this: UPDATE NameTran SET template = ALLTRIM(template), name = ALLTRIM(name).
Then something like this: LOCAL lcWorkName As String LOCAL ARRAY laJunk[1] SELECT Work SCAN lcWorkName = Name select Name from NameTran nt WHERE nt.template LIKE lcWorkName ; INTO ARRAY laJunk IF _TALLY = 0 INSERT INTO NameTran (template) VALUES (lcWorkName) ENDIF ENDSCAN Alternatively, you could do the whole thing using SQL and a correlated sub-query. Laurie ________________________________ From: Joe Yoder <[email protected]> To: [email protected] Sent: Friday, 31 January 2014, 15:14 Subject: Searching for a template that matches an item I'm working on a routine that gets names from a table of templates. I start with a string that needs to be converted to a name and scan the Template table to see if an existing template matches the string being evaluated. If none is found, the string is added as a template for manual editing. Here is the working code I am using. * NameTran is a table with 2 fields, Template C(40) and Name C(40) * Work is a cursor with untranslated strings in the Name field * Add records to the name translation table that are not already translated there SELECT Work SCAN select Name from NameTran; where LIKE(ALLTRIM(NameTran.Template), Work.Name); INTO ARRAY junk IF _tally = 0 INSERT INTO NameTran (Target) VALUES (Work.Name) endif ENDSCAN This is the first time I can remember ever using the "LIKE" function. I thought I should be able to use it with "SEEK" or as "INSERT INTO FOR" but I didn't find one. When I decided to try the SQL select approach I thought there should be a one liner that returns true or false but no joy there either. So my question for the experts is - Is there a better/more elegant way? Thanks in advance, Joe --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cabqednvtpkyv6ozenvdy8fal+uvxer2k6ouxtxd6b8y_h_c...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious. --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

