Hi Kai,
Here's a different approach, it duplicating cursor and then removing what's not
wanted. Be interested in knowing if it's faster or slower. (Only you will
know if deep's required.) ...
------------------------
cursor: [
[100 "Kai" 49 #764-0929]
[101 "Zu" 52 #764-0915]
[102 "Dewi" 16 #312-1772]
]
cols: [1 2 4]
remove-columns: function [cursor [block!] columns [block!]][tmp result][
result: copy/deep cursor
tmp: copy []
repeat value length? result/1 [
if not find columns value [append tmp value - 1]
]
forall result [
foreach column tmp [
remove skip result/1 column
]
]
head result
]
probe remove-columns cursor cols
---------------------
Not much tested, mind!
-- Carl Read.
On Thursday, 29-Novenber-2007 at 11:24:41 Kai Peters wrote,
>> Hi Kai:
>> I'm not sure if I fully understand your need, but if you are looking for=
> column values 1, 2 & 5,
>> why not compose your SQL query to those specific columns in that order? as=
> in "select
>> col1,col2,col5 from MyTable"? If I've missed the boat here - sorry! Oh,=
> and what do you mean by
>> 'transform'? regards tim
>
>Or - to hopefully make it even more clear:
>
>Here's what I have been using:
>
>cursor: [
> [ 100 "Kai" 49 #764-0929]
> [ 101 "Zu" 52 #764-0915]
> [ 102 "Dewi" 16 #312-1772]
> ]
>cols: [ 1 2 4 ]
>
>remove-columns: function [ cursor [block!] columns [block!]] [ tmp result ]=
> [
>
> result: copy []
> foreach record cursor [
> tmp: copy []
> foreach column columns [
> append tmp pick record column
> ]
> append/only result tmp
> ]
> result
>]
>
>probe remove-columns cursor cols
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.