on 06-16-2016 6:21 AM
Hi All
I need to check whether the given address is valid only if contains the strings like "Ave", "St", "Blvd" ,"Rd" . I tried using the match Regex() function with the following syntax, However its not yielding the desired results. Following is part of my "Address filed"::-
The Regex used in Information Steward :-
BEGIN
RETURN match_regex($Address, '"Ave","St","Rd","Blvd","Dr"', 'CASE_INSENSITIVE');
END
The test results (unexpected):-
Hi,
please try the below rule.
begin
if(upper($address) in ('ave', 'st','rd','blvd','dr'))
return true;
else
return false;
end
or u can use this one also
begin
if(upper($address) like ('%ave%', '%st%','%rd%','%blvd%','%dr%'))
return true;
else
return false;
end
the above rules will be moved to passed data set. If u want to move those records which r having those above keywords change the code to:
return false;
else
return true;
end
mark it as helpful/correct answer if it is useful to u For yesterday and todays answer 🙂
regards
krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The solution described above(using In) isn't providing the desired results . The In example is returning all the values either all false or all True(if we alter the positions of true and false).But If i try with Like is ending up with syntax errors:-
I was wondering about the alternative solution for this, but like should actually workNeed Help
Actually, his other exampkle with like is not correct either. Not at all! Why do you mark that as a helpful answer??? It's not helpful at all, just misleading, I am sorry.
The "in" operator has multiple operands at right-hand side.
The "like" operator suppports a single right-hand operand only.
And the upper function turns everything into uppercase,too. That will never lead to a match with lower case strings.
So what you can try is:
return lower($address) like '%ave%' or lower($address) like '%st%' or lower($address) like '%rd%' or lower($address) like '%blvd%' or lower($address) like '%dr%';
But beware! This is not a good use case for Information Steward. Values like 'First Orchard Square' will also Pass.
Hi
I am just a beginner, and I am seriously thankful and grateful towards the spirit of helping and contributing towards a problem,to such an extent by experienced programmers,consultants at any point of time.Opening up towards various sources of information is a great help towards the process of learning.
In this case for example,I tried a way to use the regex and got another way to use In and Like(although might be with syntax errors initially as posted),which again triggered me towards the search of various possible solutions, finally satisfied with Like syntax(Solution by Dirk).
This may not be of much help for experienced people, but for a novice like me found it helpful, as an add on information and alternative ways towards a solution(hence marked)
But Dirk's and his posts and similar help by other consultants and experienced people in these forums, are just great and awesome
Thanks a lot to all of you. Thanks a lot Dirk
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.