[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Name



if you have a standard in the flat file that says you will always have a
lastname,firstname with no spaces and seperated by a comma, and that a
middle name/initial will follow the firstname with a space in between, then
this is easy.  Otherwise, it'll be more complicated.


let $fullname = 'Beach,Linda'     !i assume this comes from a file

unstring $fullname by ',' into $lastname $other
unstring $other by ' ' into $firstname $middlename

if all($middlename) 
   **give warning**
end-if

let $lastname = UPPER($lastname)
let $firstname = UPPER($firstname)

BEGIN-SELECT
UPPER(lastname) &lname
UPPER(firstname)        &fname
        let $lname = &lname
        let $fname = &fname
        if $lname = $lastname and $fname = $firstname
                DO somethingcool
        end-if
from table
where [$where_clause]
END-SELECT

I did the 'UPPER' part because it will match 'Linda' to 'linda' and 'Beach'
to 'beach'.  You'll have to make sure that your flatfile has the convention
of lastname,firstname middlename on each line.  you may also want to check
$middlename some other way...depending on what you want your warning to be.


Another option in your comparison is to put the lastname/firstname check in
the where clause...i guess that all depends on what you actually want to do
once you've found a match.

BEGIN-SELECT
inf1
inf2
        do something
from table
where UPPER(lname) = $lastname and UPPER(fname) = $firstname
END-SELECT



-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
radhika reddy
Sent: Tuesday, November 30, 2004 10:10 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Name


Hi,

    I need some help in getting lastname and middle name from the following 
string which i get through a flat file. Some names have middle name at the 
end and some don't(like M and R). I want to get the last name and first name

and give a warning message when there is a middle name.

Beach,Linda
Ward,Joan
Williams,Robert M
kim,mellisa R

I extract this field by $name = 'Beach,Linda'. Then i want to compare this 
with database fields something like this:

&lastname = 'Beach' and &firstname ='linda'  and if there is a middle name 
give warning message.

How to do this? any ideas?

Thanks.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users