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.

Reply via email to