Focal Point
[SOLVED] Alphanumeric to numeric

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8087001196

February 12, 2019, 05:49 AM
Ronibi
[SOLVED] Alphanumeric to numeric
Hai

I have a field called IBAN, alphanumeric 18
This is the value 'NL38RABO0192345678'
I want the numeric part 0192345678, so I want a numeric 10 field, preferably packed 11, P11

So i used these functions in transformation in Datamigrator. In the GUI.

TO_NUMBER(EDIT(SUB_REK_ID,'$$$$$$$$9999999999'))
But then the system says: EXTERNAL FUNCTION OR LOAD MODULE NOT FOUND: TO_NUMBER

DB_EXPR(CAST(SUBSTR(SUB_REK_ID,9,10) AS DECIMAL (10,0)))
This one stays red, so not accepted

How can I transform this field in the Source Transforms Calculator in DataMigrator?

Regards
Ron

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS AppStudio 8.2.04
WebFocus Datamanagement Console 8.1M
DMC
February 12, 2019, 07:59 AM
MartinY
How exactly do you us it (complete code if possible) ?
Are you sure that's it always start at the ninth digits ?

Because the following does work in a regular report
DEFINE FILE GGSALES
NUM_CD /I3 = TO_NUMBER(EDIT(PCD, '$999'));
END
TABLE FILE GGSALES
PRINT DST.PCD
      DST.NUM_CD
BY CATEGORY
END

Or TO_NUMBER() is not a valid function in Datamigrator as the error state...
If it's the case maybe you can use the following
NUM_FLD /P11 = EDIT(EDIT(SUB_REK_ID,'$$$$$$$$9999999999'));



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
February 12, 2019, 08:20 AM
BabakNYC
 
DEFINE FILE CAR
IBAN/A18 WITH CAR = 'NL38RABO0192345678';
IBCHAR/A10=EDIT(IBAN,'$$$$$$$$9999999999');
IBNUM/I9=TO_INTEGER(IBCHAR);
IBPAC/P12.2=IBNUM;
END
TABLE FILE CAR
PRINT IBAN IBCHAR IBNUM IBPAC
BY COUNTRY
END 



WebFOCUS 8206, Unix, Windows
February 12, 2019, 10:43 AM
Ronibi
Thnx all

DB_EXPR(CAST(SUBSTR(SUB_REK_ID,9,10) AS DECIMAL (10,0))) works
problem was you have to use the WITH option to identify the logical home of the expression

case closed

Regards
Ron


WebFOCUS AppStudio 8.2.04
WebFocus Datamanagement Console 8.1M
DMC