How To: Delete columns of data
JB
sundown at pacifier.com
Thu Sep 4 15:26:01 EDT 2014
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
On Sep 2, 2014, at 11:13 AM, FlexibleLearning.com <admin at FlexibleLearning.com> wrote:
> This takes 2ms to remove 4 columns from a 100x100 data table...
>
> on mouseUp
> --| Syntax: deleteColumns <data>,<cols>
> --| data: Specifies the data to parse
> --| cols: A comma separated list of columns to be removed
> deleteColumns fld "Input","5,10,15,20"
> -- Specify what to do with 'the result'...
> put the result into fld "Output"
> end mouseUp
>
> -- A single variable approach
> on deleteColumns pData,pColsToDelete
> 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
>
>
> An enhancement request has been submitted to allow non-sequential keys to be
> combined. Meanwhile, this does it.
>
> Hugh Senior
> FLCo
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list