Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Have I made any errors in this code?
Message
From
29/08/2012 10:54:48
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Have I made any errors in this code?
Miscellaneous
Thread ID:
01551822
Message ID:
01551822
Views:
101
I suspect I have made a mistake and cannot see it. Can you?
I am looking up a key word and seaching a string (lcTEXT) for that key word.
If the keyword is found then 30 characters on either side of the found key word
should be collected and stored in the results table.

VFP Help is pasted below.
***********************WORKING HERE*************************
	IF LEN(ALLTRIM(lcTEXT)) > 3
		SELECT KEYWORDS
		SCAN
		TempKey = KEYWORDS.keyword
		TempKey = LOWER(TempKey)
		TempCtrlWord = KEYWORDS.ctrlword
		IF Tempkey $ lcTEXT
				SELECT results  
				APPEND BLANK
				REPLACE results.WORD WITH TempKey
				REPLACE results.ctrlword WITH TempCtrlWord
				WordStart = AT(lcTEXT, TempKey,1)
				PreWord = SUBSTR(lcTEXT,(WordStart-31),30)
				REPLACE Results.pre WITH PreWord
				WordEnd = RAT(TempKey,lcTEXT,1)
				PostWord = SUBSTR(lcTEXT,(WordEnd+1),30)
				REPLACE Results.Post WITH PostWord
				SELECT KEYWORDS
				Thisform.refresh &&& TEMP DEBUG
			ENDIF			
		ENDSCAN
* RAT(cSearchExpression, cExpressionSearched [, nOccurrence])
* RAT Returns the numeric position of the last (rightmost) occurrence
* of a character string within another character string.

* AT(cSearchExpression, cExpressionSearched [, nOccurrence])
* Returns the beginning numeric position of the first occurrence
* of a character expression or memo field within another character
* expression or memo field, counting from the leftmost character.

* SUBSTR(cExpression, nStartPosition [, nCharactersReturned])
* Returns a character string from the given character expression
* or memo field, starting at a specified position in the character
* expression or memo field and continuing for a specified number
* of characters.
********************END WORKING HERE*************************
I ain't skeert of nuttin eh?
Yikes! What was that?
Next
Reply
Map
View

Click here to load this message in the networking platform