Jump to content

If statement problem- for me- on how to detect several items


This topic is 3366 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Lee Smith
ADDED
Link to comment
Share on other sites

This topic is 3366 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.