January 16, 201610 yr 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.
January 16, 201610 yr Let ( [ _returnDelimited = Substitute ( "0797-8851-1" ; "-" ; ¶ ) ; _firstValue = GetValue ( _returnDelimited ; 1 ) ] ; GetAsNumber ( _firstValue ) )
January 17, 201610 yr Author 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
January 17, 201610 yr 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 ) )
Create an account or sign in to comment