Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a String of Characters in ANY Field
Message
 
À
17/09/1999 10:15:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00265873
Message ID:
00266191
Vues:
25
>>Any such thing in the FoxPro Command Language that works like Edit > Find (where it will find a string of characters, no matter what field they're in)???
>
>This will find any string in the current Alias() in any character or memo field.
>Just instance it and Show().
>
>DEFINE CLASS Finder AS form
>	Height = 73
>	Width = 375
>	DoCreate = .T.
>	AutoCenter = .T.
>	Caption = "Find"
>	Name = "frmFinder"
>	ADD OBJECT cmdok AS commandbutton WITH ;
>		Top = 41, ;
>		Left = 192, ;
>		Height = 27, ;
>		Width = 84, ;
>		Caption = "\<OK", ;
>		Default = .T., ;
>		TabIndex = 2, ;
>		Name = "cmdOK"
>	ADD OBJECT command1 AS commandbutton WITH ;
>		Top = 41, ;
>		Left = 283, ;
>		Height = 27, ;
>		Width = 84, ;
>		Cancel = .T., ;
>		Caption = "\<Cancel", ;
>		TabIndex = 3, ;
>		Name = "Command1"
>	ADD OBJECT label1 AS label WITH ;
>		AutoSize = .T., ;
>		Caption = "Find", ;
>		Height = 17, ;
>		Left = 12, ;
>		Top = 12, ;
>		Width = 26, ;
>		TabIndex = 4, ;
>		Name = "Label1"
>	ADD OBJECT txtfindwhat AS textbox WITH ;
>		Height = 23, ;
>		Left = 48, ;
>		TabIndex = 1, ;
>		Top = 8, ;
>		Width = 312, ;
>		Name = "txtFindWhat"
>	PROCEDURE cmdok.Click
>		IF EMPTY(ALIAS())
>		   =MESSAGEBOX("No table open",32,"Finder")
>		   ThisForm.Release()
>		   RETURN
>		ENDIF
>		cFindExpr=""
>		FOR i = 1 TO FCOUNT()
>		   IF VARTYPE(EVAL(FIELD(i)))="C" OR VARTYPE(EVAL(FIELD(i)))="M"
>		      cFindExpr=cFindExpr+"'"+ALLT(UPPER(ThisForm.txtFindWhat.Value))+"' $ UPPER("+FIELD(i)+") OR "
>		   ENDIF
>		ENDFOR
>		cFindExpr=LEFT(cFindExpr,LEN(cFindExpr)-3)
>		LOCA FOR &cFindExpr
>		ThisForm.Release()
>	ENDPROC
>	PROCEDURE command1.Click
>		ThisForm.Release()
>	ENDPROC
>ENDDEFINE
>
Hi John, I did see the code in this message. Thanks again.
Chuck Henry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform