ken_s2007 Posted July 14, 2009 Posted July 14, 2009 I'm guessing the answer is fairly obvious (or else I'm making this too complicated), but ... I have two fields, field1 and field2. I have another field, whichField, which uses a value list containing field1 and field2, so that the user can select a field on which to perform an operation in a script. In the script, I want to get the value of the field1 or field2 (in the active record) being referred to by whichField. If whichField is set to field1, and field1 (in the active record) contains "cat", I want to get that value. I've looked in the functions, but am either overlooking something, or am thinking about this the wrong way.
comment Posted July 14, 2009 Posted July 14, 2009 I am not sure what you're hoping to accomplish by this arrangement, but look (carefully) at the GetField() function.
ken_s2007 Posted July 21, 2009 Author Posted July 21, 2009 (edited) That is it! I'm building an interface where the user enters the number of characters desired to be padded out with leading zeros, and then chooses which field to be padded, using a field "whichField", which has a pop up value list of the possible fields to choose from. E.g., if the desired padding # is 8, and the field to be padded is "345678", I want the result to be "00345678"). Thank you. Update (pardon for changing the subject). When I run an 'Exit Loop If' using: Length ( $leadingZerosText ) + Length ( GetField ( AddLeadingZeros::WhichField ) ) = Length ( AddLeadingZeros::DesiredStringLengthOfField ) ... and the results get to (after some looping) '2+6=8', the loop doesn't exit. Even if I change to ≠. If I run "2+6=8" it exits. Ken Edited July 21, 2009 by Guest
comment Posted July 21, 2009 Posted July 21, 2009 I don't think I can answer that without seeing the entire picture. BTW, you do not need a script to pad a field (as it seems you are doing). A simple calculation like = Right ( "000000000000" & text ; targetLength ) should be quite sufficient. You can also use = Substitute ( 10^n -1 ; "9" ; "0" ) to generate a string of zeros of arbitrary length (up to 404).
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now