Jump to content

Split Field


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

Recommended Posts

I have a field that has both customer # the customer in one field!

I need to split the two out. simple yes, or so I thought untill I noticed that sometimes they did not enter the customers #.

So I need a calc that will split them. Only grab the first numbers for the customer # and only grap the text for the customer name.

Any Ideas?

Thanks

Devin

Link to comment
Share on other sites

Devin,

I guess it would depend on how exactly the customer number is structured and Customer Name.

You can use functions such as LeftWords, Right, Filter, GetAsNumber, Position, etc. It all really depends on the data that you have in your fields.

It can be as simple as GetAsNumber to get the account number into a field if its strictly numerical. etc etc...

Link to comment
Share on other sites

BTW is customer# always on the left side of the text field ? And is it possible that there is a number into the customer name ?

The customer # is allways on the left side! When it is placed it has a space between number and name.

Yes there is a number is a customer name. I know of one so far.

Link to comment
Share on other sites

If this is always true, then for customer Acct number, you can use the LeftWords Function.

LeftWords (Field;1)

For the rest of the account name, you can use.

RightWords ((Field); WordCount(Field)-1)

Edited: Oops forgot to put the logic in there.

Try this for the account number field.

Let ( n=GetAsNumber(LeftWords (Field;1);

Case (Length ( GetAsNumber(n)) = Length (n); c; field)

)

)





and for the account name field


Let ( [ n=GetAsNumber(LeftWords (Field;1); c= RightWords ((Field); WordCount(Field)-1)];



Case (Length ( GetAsNumber(n)) = Length (n); n; "")

)

Edited by Guest
Link to comment
Share on other sites

Devin,

I guess it would depend on how exactly the customer number is structured and Customer Name.

You can use functions such as LeftWords, Right, Filter, GetAsNumber, Position, etc. It all really depends on the data that you have in your fields.

It can be as simple as GetAsNumber to get the account number into a field if its strictly numerical. etc etc...

The customer number is only numbers. I guess I'm not sure of the filter part.

Here is a calc that I would use to grab the customer name if every record had a customer # placed.

if(wordcount(cust) < 2, cust,rightwords(cust,wordcount(cust)-1))

I guess the part I'm missing is the filter part?

Link to comment
Share on other sites

Ok

so

customer# :

[color:red]Case(

Length ( GetAsNumber ( LeftWords ( customerAll ; 1 ) ) ) = Length (LeftWords ( customerAll ; 1 )) ;GetAsNumber ( LeftWords ( customerAll ; 1 ) );

""

)

(the case statment look if the first word is composed of all and only numbers ... as I wish that the first word of a customerName isn't all numbers only ) :)

customerName :

[color:red]Trim ( Substitute ( customerAll ; customer# ; "" ) )

Link to comment
Share on other sites

This topic is 6757 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.