Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicates in a wizard generated form
Message
From
11/03/1999 06:19:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/03/1999 04:15:46
Fida Shamsoodeen
Combined Systems (Pty) Ltd
Centurion, South Africa
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00196254
Message ID:
00196271
Views:
22
>Hi,
>
>Can you please help me with this...
>
>I have generated a form with a wizard...
>I have two fields namely assets and sub-asset.
>I have a regular index called assetsub which is assets+sub
>I donot wish to create a primary index because i would like
>to add a duplicate record through a transfer process..
>
>The problem is how do i look for a duplicate...where do i
>put the code in the buttons...
>
>can u please HELP!!
>
>Thanks Fida
Fida,
Logically what you would do is to check for duplicate, if duplicate behave as if "Revert" is clicked (if you don't want to give user a chance to correct) :
* cmdAdd modified - warning rough code !!! not tested
llDuplicate = .f.
if this.parent.editmode
* Assets entered in txtAsset and the other txtSub
select recno() from (yourtable) ;
 where assets+sub == ;
  padr(thisform.txtAsset.value,fsize("assets",yourtable)," ")+;
  padr(thisform.txtSub.value,fsize("sub_asset",yourtable)," ") ;
  into array aCheck
* if required use lower, upper etc
if type("aCheck") = "N"
   for ix = 1 to alen(aCheck,1)
       if aCheck[ix,1] # recno(yourtable) && is it not the one we're editing ?
           llDuplicate = .t.  && Duplicate catch
           exit
       endif
   endfor
endif
endif
if llDuplicate
 this.parent.cmdEdit.click  && Revert by clicking revert
else
 dodefault()
endif
Basic idea is SQL doesn't select from buffers and wizard uses buffered tables (good:).
Another quick check trick is to "use again" the same table ordered by check tag and do a seek()+scan while..endscan on it (buffered data doesn't exists in table "used again" :).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform