matchText and card #

Richard Gaskin ambassador at fourthworld.com
Sat Oct 9 09:36:37 CDT 2010


On 10/9/10 7:02 AM, Eva Isotalo wrote:
> The UTF-8, I used the 'replace' because I got an error on the other one
> and since the 'replace' works it'll be ok to keep it. :)

Glad you have a solution.  I missed replying to your note on that as 
I've been immersed in a hefty beta for a client, but ironically much of 
what we're adding to that code base involves Unicode support so if you 
encounter issues like that in the future I may be able to help you avoid 
some of the blood, sweat, and tears I've accrued in this cycle. :)


> The matchText. Script is run from an "importer" stack that imports a cvs
> file with latest orders, checks (order by order) if a customer exists in
> the customer stack and that's where I used the matchText. I first used
> the find but needed to do both name and first line of address so the
> matchText worked brilliantly. BUT, I can't get to the card of that
> stack, or at least I don't know how.

This may seem a bit brute-force, but you may be surprised by how fast 
LiveCode is with "repeat for each":

-- Assumes a simple CSV format with no escaping (don't get me started
-- on how evil CSV is), with each line containing these items:
-- 1. Name
-- 2. Address
-- 3. City
-- 4. State
-- 5. PostalCode

function FindCustomer pName, pAddress, pList
   -- pName is the name you're looking for
   -- pAddress is the first line of the address you're looking for
   -- pList is the CSV data
   repeat for each line tLine in pList
      if item 1 of tLine = pName AND item 2 of tLine = pAddress then
         return tLine
      end if
    end repeat
end FindCustomer


How that relates to finding the card in the stack is something I can't 
advise on without known how the stack is set up (card names, etc.), but 
if you still need a hand just describe what you have and we'll find a 
solution together.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv


More information about the metacard mailing list