Jump to content

using numbers in Text fields for Text functions


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

Recommended Posts

Help. My scripting is a little rusty.

I have a text field that is only inhabited by 5-digit numbers. I want to write a script that looks at the first 2 characters in the field and fills in another field based on what they are.

I thought I could use the "Left" Text function to return the first 2 characters in the number string. Doesn't seem to work though.

Anyone suggest a method for doing this? I can post the body of the script thus far if you want to see the exact functions or syntax.

Thanks in advance.

Chris

Link to comment
Share on other sites

The Left[] function should work. Text includes digits as well as letters.

Just a small thought though... the "numbers" are treated as strings of text, which might create unexpected results:

Value Left[Value, 2]

------------------------------

12345 12

10998 10

76249 76

99 99

2 2

Exactly how is the function not performing the way you expect? By "first two characters" do you mean from the left, or from the right?

[This message has been edited by Vaughan (edited January 15, 2001).]

Link to comment
Share on other sites

Firstly I can't see why you should want to use a script for the calculation rather than just using a calculated field. However, assuming you have good reason for doing so, I have tried it using Left(Text Field,2)* 5 as the calculation and it works perfectly regardless whether or not you specify the result as text or a number. Can you email me the script?

Link to comment
Share on other sites

This topic is 7877 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.