| View previous topic :: View next topic |
| Author |
Message |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Mon Feb 16, 2004 10:30 am Post subject: Dupe checking |
|
|
Can some one please help me with making a dupe checking script.
I have one list "1" full of data, and a blank list "2" ready for the new data.
I want to copy an item at a time across from 1 to 2, and check the its not already in 2.
I have written some code but it seem to delete items that are only half a match to.
How can i make it do on exact matches? |
|
| Back to top |
|
 |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Mon Feb 16, 2004 10:50 am Post subject: |
|
|
Try something like this:
| Code: |
list seek, 1, 0
repeat
list seek, 2, 0
# I dunno if I use the correct syntax for the @match function, you might what to check it...
if @not(@match(@item(1), 2))
list add, 2, @item(1)
end
if @unequal(@count(1), @succ(@index(1)))
list seek, 1, @succ(@index(1))
else
%%Done = 1
end
until %%Done
|
Regards,
Vic _________________ phpBB Development Team |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Feb 16, 2004 12:15 pm Post subject: |
|
|
I think the problem DW has is with partial matches, and you cannot solve that by just using @match() in a list
coz if output list already has "somestring" then you'll get a match from "string" also, even though it's
not there as a separate entry...
I would do this:
| Code: |
list create,1
list add,1,somestring
list add,1,string
list add,1,string2
list add,1,string
list add,1,strung
list create,2
%%count1 = @count(1)
list seek,1,0
REM Remove next line for case insensitive matching
%%exact = EXACT
repeat
%%item = @next(1)
if @match(2,%%item)
REM Match found - may be partial
%%found = 0
repeat
%%item2 = @next(2)
if @equal(%%item2,%%item,%%exact)
REM It's a full match
%%found = 1
end
until @null(@match(2,%%item))
if @equal(%%found,0)
list add,2,%%item
end
else
list add,2,%%item
end
list seek,2,0
until @equal(%%count1,@index(1))
info @text(2)
stop
|
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 16, 2004 1:24 pm Post subject: |
|
|
Not sure about VDS 5, but earlier versions can use
a CREATED sorted list (LIST CREATE, 1, SORTED).
We've had discussions as to whether this is a "bug" or
a "feature" - but for some reason they automatically
remove all duplicate entries.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Feb 16, 2004 2:38 pm Post subject: |
|
|
Hey Mac!
This behaviour of sorted lists was my first thought also coz it would be far the easiest approach. But then the
output will be sorted alphabetically as well. So it depends on how one needs the output ordered.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Feb 16, 2004 2:45 pm Post subject: |
|
|
Hey Dread,
True, and in some instances ya just don't want data sorted.
BTW, do VDS 5 lists still do this?
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon Feb 16, 2004 2:59 pm Post subject: |
|
|
Yup. That behaviour is exactly the same. Sometimes it can be quite useful and sometimes a pain in the ***.
And it could be argued, like you mentioned, whether this is a bug or a feature.
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|