Filtering Columnar Data

Josh Mellicker josh at
Mon Jul 16 19:46:33 EDT 2007

Also, I would suggest finding the exact ColumnNum as part of the  
handler- either from the header row, or a separate header variable.

If you don't, as the database evolves and columns are added (or  
deleted), then you'll have to go back and change all your hardwired  
column references... or change your data around to make the columns  
right, both big hassles...

On Jul 16, 2007, at 2:04 PM, Gregory Lypny wrote:

> function filterByColumn theData,columnNum, theSearchString
>   -- This function filters tab-delimited data by column
>   if columnNum is an integer
>   then
>     set the itemDelimiter to tab
>     repeat for each line thisLine in theData
>       if item columnNum of thisLine is theSearchString
>       then
>         put thisLine & return after filteredData
>       end if
>     end repeat
>     delete the last character of filteredData
>     return filteredData
>   else
>     return "The column number must be an integer."
>   end if
> end filterByColumn

More information about the Use-livecode mailing list