 |
whovind Newbie
Joined: 11 Nov 2002 Posts: 5 Location: Canada
|
Posted: Wed Nov 20, 2002 8:04 pm
Finding Duplicates with %Query |
I'd like to only add records to a DB when the record doesn't already exist. At some point perhaps do updates as well. The problem is the unique "key" as far as the mud is concerned isn't the name but a combination of all/many of the fields.
I've looked at query and I can't seem to get it to work with strings. In a perfect world I'd have something like:
#IF {%query(((&HITROLL<>@NewItem.HITROLL)OR(&DAMROLL=@NewItem.DAMROLL) OR(&Name=@NewItem.Name),ALL) }
{ insert code here }
Is this possible?
Thanks,
Piedtyper |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Nov 20, 2002 11:34 pm |
If %query doesn't work well for your application, do something else.
#VAR new 1;#VIEW ALL;#DBFIRST;#LOOP %numrec() {#IF ((&HITROLL <> @NewItem.HITROLL) OR (&DAMROLL = @NewItem.DAMROLL) OR ({&Name} = {@NewItem.Name})) {} {#VAR new 0};#DBNEXT};#IF (@new) {insert code here}
LightBulb
Senior Member |
|
|
 |
|
|