Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with sorted table
Message
 
 
À
23/08/2001 16:16:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00546949
Message ID:
00548297
Vues:
13
>>>>Hi everybody,
>>>>
>>>>I have a table, which is sorted by upper(State+OwnerCity+OwnerStrt+...). I have a button on my form called Manual Match, which allows to overwrite data with data from Streets lookups. This is a code fragment from this button:
>>>>
>>>>	if m.llPerform
>>>>		replace OZipped with "M", ModiType with "C", ;
>>>>			OwnerCity with proper(Streets.City), ;
>>>>			OwnerState with Streets.State, ;
>>>>			OwnerZip5 with Streets.zip_code, ;
>>>>			OwnerPlus4 with Streets.zip4, ;
>>>>			OwnerCr_rt with Streets.carrier_rt, ;
>>>>			OwnerStrt with proper(Streets.street) in BldMstr
>>>>		if !eof()
>>>>		   skip
>>>>		else
>>>>		   if !bof()
>>>>		      skip -1
>>>>		   endif
>>>>		endif
>>>>		this.parent.parent.refresh()
>>>>		.freshen()
>>>>		.nManualProcessed=.nManualProcessed+1
>>>>		.nProcessed = .nProcessed + 1
>>>>	endif
>>>>
>
>PMFJI, but the logic above worries me.
>
>First, you don't have a 'Select BldMstr'. So the skip etc. may not be operating on this table; the replace has an 'in BldMstr' clause.
>
>Second, if your selected alias is BldMstr, you immediately test for eof()
>after the replace. If the replace works, you can't be at eof() ! Similarly, you can't be at bof() either.
>
>Should your logic not be e.g.
>
>
>   select BldMstr
>   ...
>   if ! eof()
>      skip
>   else
>      go bottom
>   endif
>   if eof()
>      go bottom
>   endif
>   if bof()
>      go top
>   endif
>   ...
>
>
>or something similar.
>
>Mike

Thanks, I guess, you're right. I've changed this logic already by creating a new method in my form called MoveNextRecord. This method seems to work fine.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform