Jump to content
Server Maintenance This Week. ×

Strip the last five characters from a field name


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

Recommended Posts

Howdy, all.

I know I'm close...maybe. I'm trying to create a calc that'll strip the last five characters off a field name, regardless of its length. So far, I've come with:

Left ( Get ( ActiveFieldName ) ; Length ( Get ( ActiveFieldName ) - 5  ) )

...but it's not working, e.g., with a field name of County__lxt the result of the calc is Co. I thought of using multiple Substitute commands but that's shaping up to being real klunky. What's the final bit that I need?

As always, thanks in advance for your help!

Link to comment
Share on other sites

Try:

Left ( Get ( ActiveFieldName ) ; Length ( Get ( ActiveFieldName ) ) - 5 )

 

Remember both Length() and Get() need closing brackets BEFORE the Left() is closed.

Link to comment
Share on other sites

10 hours ago, WF7A said:

I know I'm close...

Yes, you are. To expand on what LaRetta said, you are subtracting 5 from the actual field's name, instead of from its length. You are doing =

Get ( ActiveFieldName ) - 5

which in your example is evaluated as =

"County__lxt" - 5

resulting in -5. And since the length of "-5" is 2 characters, you're getting the first 2 characters of "County__lxt" as the overall result.

 

Link to comment
Share on other sites

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