I cannot get the below to work with a LIKE variable within the If/Then statement. Is there something that I am missing?
dim y If [Categories] LIKE '%Orange%' Then y = "Medium" Else y = [Categories] End If Status = y
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
There is no LIKE comparison operator in VB Script (see link).
You could use InStr to check if some search text appears somewhere in the input string:
dim y If InStr([Categories], "Orange") Then y = "Medium" Else y = [Categories] End If Status = y
InStr will return
0 if the search text is not found, which will be interpreted as False in the condition statement.
If you want to search some text explicitly in the begining of the input string, just check if the value returned from InStr is
If you want to search some text in the end of the input string, try Right function to extract part of the string and then do the comparison.