views:

48

answers:

1

I put the following in the record formula which strips down the domain name to just the name. For example, if the domain is mit.edu, it returns mit. if it the domain is pluto.mit.edu, it returns mit.

    if count > 1
       c := mid(left({?domainname}, instrrev({?domainname},".")-1, instr(left({?domainname}, instrrev({?domainname},".")-1), ".")+1)
    else 
       c := left({?domainname),instr({?domainname},".")-1); 

     instr({bob.domain},c) =1

My problem is if the domain is "mit", it will return all items with the corresponding mit.edu in the {domain} field, but not the items with a subdomain such as new.mit.edu any ideas why this is?

+2  A: 

Try changing instr({bob.domain},c)=1 to instr({bob.domain},c)<>0

Your code is only catching strings that begin with the parsed domain name (character position 1). So, if c="mit" and you want to match on the record {bob.domain}="new.mit.edu" then you must consider the string c appearing at any point in the domain -> instr("new.mit.edu","mit")=5, not 1.

Ryan