kcep Posted January 16, 2016 Posted January 16, 2016 I'm needing a calculation field that returns only a portion of another field (Product_Number). For Product_Number 0797-8851-1 the result should be 797 (no leading zero) For Product_Number 5-4781-3-43 the result should be 5 For Product_Number 579-287-9-154 the result should be 579 Get the idea? The result should equal the number before the first dash (except if there is a leading zero). In the case of a leading zero, I do not need the leading zero.
jbante Posted January 16, 2016 Posted January 16, 2016 Let ( [ _returnDelimited = Substitute ( "0797-8851-1" ; "-" ; ¶ ) ; _firstValue = GetValue ( _returnDelimited ; 1 ) ] ; GetAsNumber ( _firstValue ) ) 1
doughemi Posted January 16, 2016 Posted January 16, 2016 Try: GetAsNumber(Left(Product_Number;Position(Product_Number; "-"; 1; 1)-1)) 1
kcep Posted January 17, 2016 Author Posted January 17, 2016 Ok, I didn't think I would need this when I posted my original question, however, it looks like I will need an additional calculation field that yields the number between the first dash and the second dash also. For Product_Number 0797-8851-1 the result should be 8851 For Product_Number 5-04781-3-43 the result should be 4781 (no leading zero) For Product_Number 579-287-9-154 the result should be 287 Sure appreciate any help getting this solution. Thanks
comment Posted January 17, 2016 Posted January 17, 2016 8 minutes ago, kcep said: it looks like I will need an additional calculation field that yields the number between the first dash and the second dash You should have known how to do this by adapting the solutions given to your original question: jbante's: Let ( [ values = Substitute ( Product_Number ; "-" ; ¶ ) ; secondValue = GetValue ( values ; 2 ) ] ; GetAsNumber ( secondValue ) ) doughemi's: Let ( [ start = Position ( Product_Number ; "-" ; 1 ; 1 ) + 1 ; end = Position ( Product_Number ; "-" ; 1 ; 2 ) ; mid = Middle ( Product_Number ; start ; end - start ) ] ; GetAsNumber ( mid ) ) 1
Recommended Posts
This topic is 3290 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 accountSign in
Already have an account? Sign in here.
Sign In Now