hownow Posted January 29, 2015 Posted January 29, 2015 I have a lot of records which end in either .org/ .com/ .us/ .net/ How can I write a statement that determines if any of those are present? The way I have been doing it is to write 4 separate statements. I am asking how to write it correctly if there are a lot of different texts strings that I am trying to detect. In my own words It would be something like this If my field ends with ".org/ " ".com/ "" .us/ " " .net/ " Perform script But they are not always 4 characters. Thats the problem. PLease help if this is not hard for you. Thanks
Wim Decorte Posted January 29, 2015 Posted January 29, 2015 Check out the patterncount() function, user one for each string you want to test for.
hownow Posted January 29, 2015 Author Posted January 29, 2015 The script is supposed to find the presence of .org/ .us/ .net/ .com/ if the end of the text in my text field ends with one of those. If that is the case I want to play a script I already use. If that is not the case to do nothing.
eos Posted January 29, 2015 Posted January 29, 2015 I am asking how to write it correctly if there are a lot of different texts strings Do you mean: lots of strings to test, or to test against? If the latter, then you could try Let ( [ allowedDomains = "org¶com¶us¶net" ; thisDomain = Substitute ( YourTable::yourSourceField ; [ "." ; ¶ ] ; [ "/" ; "" ] ) ; thisDomain = RightValues ( thisDomain ; 1 ) ] ; not IsEmpty ( FilterValues ( thisDomain ; allowedDomains ) ) ) For just four strings, that not really progress in comparison to PatternCount(); but instead of hardcoding a list of allowed domains, you could reference e.g. a field with such a list, and extend that list without having to modify the calculation.
Lee Smith Posted January 29, 2015 Posted January 29, 2015 (edited) The script is supposed to find the presence of .org/ .us/ .net/ .com/ if the end of the text in my text field ends with one of those. If that is the case I want to play a script I already use. If that is not the case to do nothing. That was the purpose of my question - What will the script do as a result of the present of these file extensions? ADDED: Copy the script so that we can see what your intent will be. Edited January 29, 2015 by Lee Smith ADDED
hownow Posted January 29, 2015 Author Posted January 29, 2015 The script just copies the contents of one field to another If those Items are present at the end of the text string The script "Copy to web address" Is Set field generic list gather::web address Copy
hownow Posted January 31, 2015 Author Posted January 31, 2015 Thank you all of you I have it working now
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now