Getting data prepped for database entry.

Dave Herndon herndogy at sbcglobal.net
Thu Nov 2 14:11:38 CST 2006


  This script pretty much gets the job done.  Stripps unwanted spaces before and aft, changes mixed or small caps to ALL CAPS, and makes ready the data for SQL data entry by wrapping the list items with 'singlequotes'  
   
  on mouseUp
  put field "data" into MyList
  repeat with x = 1 to the number of items of MyList
  put word 1 to -1 of item x of Mylist into item x of Mylist
  put "'" & item x of Mylist & "'" into item x of mylist
  end repeat
  put the toUpper of Mylist into MyList
  put Mylist into field "recip"
  end mouseUp
  the script changes 
  davo, davo , davo Herndon , davo,davo,davo , davo , davo, 
   TO
  'DAVO','DAVO','DAVO HERNDON','DAVO','DAVO','DAVO','DAVO','DAVO',
   
  Now if I can just check to see if the item is a number or a date and not do the single quote operation on those items I will be set.  As a work around I  have beem carefull to leave those items as the last items in the list and do a partial operation, say there are 6 items in the list to be added to a database record and the last two items are dates. 
   
  as in varchar1,varchar2,varchar3,varchar4,date1,date2
   
  repeat with x = 1 to 4
  put "'" & item x of Mylist & "'" into item x of mylist
  end repeat
  returns 'varchar1','varchar2','varchar3','varchar4',date1,date2



More information about the use-livecode mailing list