Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easiest way to do this search
Message
From
23/09/2018 14:47:43
 
 
To
20/09/2018 18:02:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01662162
Message ID:
01662213
Views:
41
Correct. So I ened up doing something like this
THIS.cLicenseExpression = this.BuildExpression(this.cLicense)
lcWhere = [vehicle.cLicense like '] + this.cLicenseExpression + [']

PROCEDURE BuildExpression
		LPARAMETERS tExpression

		LOCAL j, lcDigit, lcBuild
		lcBuild = ''
		FOR j = 1 TO 6
			lcDigit = SUBSTR(tExpression, j, 1)
			DO CASE
				CASE lcDigit = ' '
					lcBuild = "[ ]"
				CASE lcDigit = '1'
					lcBuild = "[1]"
				CASE lcDigit = '2'
					lcBuild = "[2ABC]"
				CASE lcDigit = '3'
					lcBuild = "[3DEF]"
				CASE lcDigit = '4'
					lcBuild = "[4GHI]"
				CASE lcDigit = '5'
					lcBuild = "[5JKL]"
				CASE lcDigit = '6'
					lcBuild = "[6MNO]"
				CASE lcDigit = '7'
					lcBuild = "[7PQRS]"
				CASE lcDigit = '8'
					lcBuild = "[8TUV]"
				CASE lcDigit = '9'
					lcBuild = "[9WXYZ]"
				CASE lcDigit = '0'
					lcBuild = [0]
				OTHERWISE
					lcBuild = "%"
			ENDCASE

			lcBuild = lcBuild + lcDigit
		ENDFOR

		RETURN lcBuild

	ENDPROC
>>I am not sure the fastest way to do this kind of search in sql server, maybe a regular expression?
>>
>>Let's say I have a 6 character varchar field. In that field are license plate nunbers, such as "L1 234", "QA3333", etc. Now the user enters via a telephone 6 numbers. (I cannot control the IVR portion and must deal with the 6 numbers.) Now given the phone pad, if a user enters "235466" that could really mean:
>>235466
>>A35466
>>B35466
>>C35466
>>2A5466
>>2B5466
>>
>>etc for millions of combinations. I need to pull the recordfs that match any of those possibilities.
>>
>>Comments?
>
>I presume that you want search such that digit would match a digit or equivalent letter found on keypad/dial on the telephone for that digit?
>1 - matches 1
>2 - matches 2, A, B, C
>3 - matches 3, D, E, F
>4 - matches 4, G, H, I
>5 - matches 5, J, K, L
>6 - matches 6, M, N, O
>7 - matches 7, P,Q, R, S
>8 - matches 8, T, U, V
>9 - matches 9, W, X, Y
>0 - matches 0
>
>note: Some phones may not have "Q" mapped to a digit on the dial/keypad
Previous
Reply
Map
View

Click here to load this message in the networking platform