Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to seperate numeric value form other data type

(0) ShareShare
ReportReport
Posted on by 231

Hi Everyone is there is any way to seperate numeric value from other data type and store it in integer data type

Eg:  Code(Variable)  := 'I9087';

I need to seperate 9087 and store it into interger variable

  • yoheswaran Profile Picture
    231 on at
    RE: How to seperate numeric value form other data type

    Thanks for the reply i got the value by using DELCHR function

  • Lars Lohndorf-Larsen Profile Picture
    on at
    RE: How to seperate numeric value form other data type

    Hello,

    I like functions like DELCHR better where possible, as they can do the hard work for you. But if nothing else works, you can scan the string char by char and keep the chars that you want. A string is an array of characters, so this is what you can do:

    OBJECT Codeunit 99996 Make Number

    {

     OBJECT-PROPERTIES

     {

       Date=20/10/21;

       Time=16:56:52;

       Modified=Yes;

       Version List=;

     }

     PROPERTIES

     {

       OnRun=BEGIN

               Code := '*oh06es/\@wa08=-hed95';

               FOR i := 1 TO STRLEN(Code) DO BEGIN

                 Char := Code[i];

                 IF EVALUATE(TestNumber,FORMAT(Char)) THEN

                   ResultTxt := ResultTxt + FORMAT(Char);

               END;

               EVALUATE(ResultNumber,ResultTxt);

               MESSAGE(FORMAT(ResultNumber));

             END;

     }

     CODE

     {

       VAR

         Code@1000 : Code[10];

         Char@1001 : Char;

         TestNumber@1005 : Integer;

         i@1002 : Integer;

         ResultTxt@1003 : Text;

         ResultNumber@1004 : Integer;

       BEGIN

       END.

     }

    }

  • yoheswaran Profile Picture
    231 on at
    RE: How to seperate numeric value form other data type

    Thanks for the reply as you say i tried by using evaluate  but it returns zero.

    Code := '*oh06es/\@wa08=-hed95';

    in here i need to return interger(numeric value) only. I tried the Delchar function, it's working but in the where parameter i need to give manually is there is any way to give the alphabet shortly 'A..Z' is not working

    Code := DELCHR(Code,'=','ABCDEFGHIJKLMNOPQRSTUVWXYZ|!|@|#|$|%|<|>|*|/|\|?|=|-');

  • Suggested answer
    JAngle Profile Picture
    95 on at
    RE: How to seperate numeric value form other data type

    Try this function: docs.microsoft.com/.../evaluate-function

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 782

#2
YUN ZHU Profile Picture

YUN ZHU 764 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 529

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans