Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Extract number from values in a field

Hi,

I have a field that has Alpha Numeric strings as data.

Example:

Field: OBJ ID

ABCD-45284-DKFNG

AB-373-FHFTU

  FDKJJGJ-4688450-ABC

        ............

I need to extract only numbers from the data and show it in a table/chart.

Note: The numbers in all the rows are not of equal length. Also, the text in before and after the number values aren't the same and are of equal length.

4 Replies
sunny_talwar

May be do this in the load script:

KeepChar([OBJ ID], '1234567890') as NumberField

Sample Script:

Table:

LOAD *,

  KeepChar([OBJ ID], '1234567890') as NumberField;

LOAD * Inline [

OBJ ID

ABCD-45284-DKFNG

AB-373-FHFTU

FDKJJGJ-4688450-ABC

];


Capture.PNG

maxgro
MVP
MVP

or this if the number is always  between "-"

Load

  [OBJ ID],

  SubField([OBJ ID], '-', 2) as [NEW OBJ ID];

LOAD * Inline [

OBJ ID

ABCD-45284-DKFNG

AB-373-FHFTU

FDKJJGJ-4688450-ABC

];

fonmarcelo
Contributor III
Contributor III

Hi

Do it:

Test:

LOAD

  SubField([OBJ ID],'-',2) as [OBJ NUMBER];

LOAD * Inline [

  'OBJ ID'

  ABCD-45284-DKFNG

  AB-373-FHFTU

  FDKJJGJ-4688450-ABC

];

Test.PNG

Anonymous
Not applicable
Author

Thanks guys. Will try out and let you know.