January 16, 200125 yr 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
January 16, 200125 yr 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).]
January 19, 200125 yr 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?
Create an account or sign in to comment