Reverse Intersect
Jim Ault
jimaultwins at yahoo.com
Tue May 25 18:53:42 EDT 2010
In the time it took to write the original email you could have
put the keys of array1 into keysOne
combine array2 using cr and tab
set the itemDel to tab
repeat for each line LNN in array2
if item 1 of LNN is not among the lines of keysOne then put LNN &
cr after newArray2
end repeat
filter newArray2 without empty
split newArray2 using cr and tab
------------------
and of course -----
put getResidualArray(array2, array1) into array2
function getResidualArray array2, array1
<< code >>
return newArray2
end getResidualKeys
Hope this helps
J
On May 25, 2010, at 2:45 PM, Bob Sneidar wrote:
>
> I know the Intersect command removes keys in array-1 that don't
> exist in array-2. What I need however is a command that removes keys
> in array-1 that DO exist in array-2, so that array-1 contains all
> the keys I need to add. Why you ask? Why not just use the Union
> command? Because I need to find all the records in table-a that need
> to be added to table b. And since I am paging through table a a
> limited number of records at a time, (to prevent Rev memory overflow
> for large tables) I cannot simply use an SQL query join, and as I
> said in a prior post the tables are in disconnected databases.
>
> So what I am doing is getting 100 records from table-a as a string,
> massaging it a bit to form a comma delimited list, then using the
> SQL IN operator to get what records there are in table-b that are
> already in table-a. At that point I need to eliminate the table-b
> keys from the table-a keys, and what I will have left are the keys
> that need to be inserted into table-b. Simple. See? ;-)
>
> So is there any way to do this without a repeat loop? I can always
> do a repeat loop, but they weary me. <sigh> ;-)
>
> Bob
>
Jim Ault
Las Vegas
More information about the use-livecode
mailing list