Jump to content

Extracting data


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

Recommended Posts

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.

Link to comment
Share on other sites

Let ( [
    _returnDelimited = Substitute ( "0797-8851-1" ; "-" ; ¶ ) ;
    _firstValue = GetValue ( _returnDelimited ; 1 )
] ;
    GetAsNumber ( _firstValue )
)

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 )
)

 

  • Like 1
Link to comment
Share on other sites

This topic is 3114 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
×
×
  • Create New...

Important Information

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