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 12:12:17
 
 
To
29/08/2012 12:03:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01551822
Message ID:
01551835
Views:
47
>>>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
>>>********************END WORKING HERE*************************
>>>
>>>
>>
>>Whether there are errors, then probably debug will show them. But I would say, there are many uncertaincies:
>>- why LEN(ALLTRIM(lcTEXT)) > 3; whether,it is good enough if you are looking for 30 characthers befor and 30 characters after the tempkey that also has a length?
>>- wheter lcText always in lower case?
>>- whether KEYWORDS.keyword does not cointain spaces at the right or left? Whether tempkey always has length of KEYWORDS.keyword ?
>>.......
>>
>>Good Luck
>> 3 = is checking to make sure lcTEXT is not ""
>lcTEXT is lowercase - I ised LOWER(lcTEXT) on it
>I will add alltrim() to the routine and repott back. - Thanks :-)


FIXED!! It was alltrim() - Thank you .
I ain't skeert of nuttin eh?
Yikes! What was that?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform