I have a simple code example for catching values of the name name that have some values that are capitalized and some that are lower case:
I would like to use a wildcard so I don't have to use the Or Statement. In the interest of standardizing oil and gas reservoir names for spatial analysis there has to be a quicker way then writing long "AND" "OR" arguments.
This is in VBscript because I couldn't see the "InStr" function or a function like it in the python examples.
I tried the following:
And it didn't work.
As always any help is much appreciated!
Solved! Go to Solution.
If the only variation you are trying to capture is due to capitalization differences, the standard approach is to use UCASE or LCASE on all parts of the equation (unless you type the word and know the case). So for your example use:
If InStr( UCASE([Reservoir]),"BARNETT" ) Then
The Instr function does not support wildcards.
If the only variation you are trying to capture is due to capitalization differences, the standard approach is to use UCASE or LCASE on all parts of the equation (unless you type the word and know the case). So for your example use:
If InStr( UCASE([Reservoir]),"BARNETT" ) Then
The Instr function does not support wildcards.
Richard,
That was an angle I didn't think of. This will work for any string field with capitalization problems. I appreciate the direction on using the nested function.
However, i would still like to know what the wildcard is in VbScript. i tried "%" but that didn't seem to be the right one. (Maybe % is python wildcard)
I can use the wildcard for fields that have misspellings or abbreviated reservoir names. The Vicksburg is a good example because some companies report it as VICKSBURG, others VXBG, or VX, or VKBG, VCKBG....etc... I tracked down each one and used "OR" statements but with a wildcard you could simplify the string. I Hope you could devise an InStr that sraches for the fields that contain V,X,K,B, and G this would catch all the fields with "Vicksburg" and variations of it.
You have to use Regular Expressions (regex) to do pattern matching. See this post for some discussion on the subject and some links to regex help. Regex can be a bit obscure to figure out and I am no expert in using it.