How To: Delete columns of data

FlexibleLearning.com admin at FlexibleLearning.com
Fri Sep 5 07:59:30 EDT 2014


Hi John

The routine lets you specify any number of columns to delete. You do not
have to use it on each column. If you have 11 columns, simply specify which
ones you do not want. If you have comma-separated data, you need to specify
the columnDelimiter. This includes that option...

on mouseUp
  --| Syntax: deleteColumns <data>,<cols>[,<delim>]
  --|     data: Specifies the data to parse.
  --|     cols: A comma separated list of columns to be removed for example
"2,5,7".
  --|     delim: Optional column separator for example "," or "|". If
unspecified, defaults to TAB.
  deleteColumns fld "Input","1,3,5"
  -- Specify what to do with 'the result'...
  put the result into fld "Output"
end mouseUp

on deleteColumns pData,pColsToDelete,pDelim
  try
    set the columnDelimiter to pDelim
  end try
  split pData by column
  put item 2 of extents(pData) into tMax
  repeat with n=1 to tMax
    if n is NOT among the items of pColsToDelete then
      add 1 to x
      put pData[n] into pData[x]
    end if
  end repeat
  repeat with n=x+1 to tMax
    delete local pData[n]
  end repeat
  combine pData by column
  return pData
end deleteColumns


Or have I misunderstood the problem you face?

Best regards

Hugh Senior
FLCo

From: JB <sundown at pacifier.com>

> That is fast but here are a few problems I
> am having.
> 
> It looks to me like you can only delete one
> column and then you use it again to delete
> another column.
> 
> I am getting a list of the detailed files which
> is a comma separated list of 11 items and I
> only want to end up with 4 columns.  When
> I use it again it looks like I need to calculate
> the column I deleted to know which columns
> I still need to delete.  Not major issue.  The
> bigger problem is this scenario.  I deleted a
> bunch of columns from a list of a little over
> 30,000 files and it worked but then I use the
> open to select another folder of files and it
> only had around 305 files but for some reason
> it appears the memory is not cleared because
> the cursor spins and won?t take me to the other
> folder.  I use Force Quit and it list Revolution as
> not responding.  It does not look like this is code
> limited to newer versions of LiveCode so I don?t
> understand why Revolution would quit responding.
> 
> John Balgenorth






More information about the use-livecode mailing list