cancel
Showing results for 
Search instead for 
Did you mean: 

Using Split to sort out contractors from Feds

Former Member
0 Kudos

split({description field}," ")[1]

I'm wondering if and how I could use this to solve another issue. Perhaps I should start anopther thread but it is along the same lines as this one.

We need to separate out the work done by the contractors and the work done by the Feds. All contractors have CTR in the middle of their name though some, because Lotus Notes won't allow duplicate names in the directory, use their middle initial. So in other words, my name is

Barbara CTR Buckley

If I were to use my middle initial my name would be:

Barbara A-CTR Buckley

Could I use this formula to somehow pull out all the contractor work and if so, how would I go about accounting for both situations (middle initial and no middle initial)? If not what would be the best way to do this?

Thanks

Barb

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There is no one easy way to do this. As you find exceptions you will have to keep adding it to the conditions. Having said that, if CTR will be part of the middle name will it always have a hyphen? If so, that will make things easier. Also check CTR with a space in front and back. For example:


if instr({description.field}," ctr ") > 0 OR instr({description.field},"-ctr ") > 0 then
"CONTRACTOR"
else
"FEDS";

The first INSTR condition should take care of names such as: Barbara CTR Buckley

The second INSTR condition should take care of names such as: Barbara A-CTR Buckley

case sensitivity depends on whether under File | Report Options you have the box next to "Database server is case-insensitive" checked or not.

Edited by: Sanjay Kodidine on Oct 2, 2009 7:50 AM

Former Member
0 Kudos

Ah, got it. So the spaces on either side would keep it from picking up actual names with CTR in them and then checking for the -CTR would account for the people who are using their middle initial.

Thanks very much. That helps alot. You guys ROCK!

Barb

Former Member
0 Kudos

If I understood correctly I think you want to split the records into two groups in which you have contractors and feds.

Contractors will have CTR in their names. So you need to create a formula like this

if instr({name field},"CTR")>0 then

"CONTRACTOR"

else

"FEDS"

now insert a group on this formula so that all the contractors group into one and feds into other.

HTH

Raghavendra

Former Member
0 Kudos

Hi

Thank you. Yes, I had thought of this but what happens if someone has "ctr" like IN their name but they are not a contractor. For instance, if their name is "Ron Vactror" or something like that. This will pick that up won't it, or putting the CTR in caps, is it case sensitive?

Thanks

Barb