Search Alphanumeric

hardik_shahhardik_shah Member Posts: 219
Dear All,

Need Help.....

Can anyone let me know how to findout That String contains other than numeric ? ? ?

Comments

  • BeliasBelias Member Posts: 2,998
    try to evaluate the string in an integer, if it fails, it contains "other than numeric characters" (ok, 88888888888888888888888888888888888888888 will fail as well because of overflow...keep this in mind).
    otherwise, you can loop every char of the string and check if it's a number (there are some topics in mibuso about it...).
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    try
    str := 'ABC12AV';
    Str2 := DELCHR(Str,'=','0|1|2|3|4|5|6|7|8|9');
    Message('%1',Str2);
    
  • hardik_shahhardik_shah Member Posts: 219
    Thanks for your swift reply...

    Kindly find the below scenario.


    AlphaNumeric(String : Code[20]) : Boolean

    For IntLoop:=1 to STRLEN(String) DO BEGIN
    Char:=COPYSTR(String,IntLoop,1)
    If Char='[A..Z]' Then BEGIN
    MESSAGE('Coming');
    EXIT(TRUE)
    END

    END

    EXIT(FALSE)


    I passed Parameter to this function 'E678-A'.

    But it not printing the message.

    I am not sure how to compare If Char='[A..Z]' Then BEGIN

    Please help me.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    try
    str := 'ABC12AV';
    Str2 := DELCHR(Str,'=','0|1|2|3|4|5|6|7|8|9');
    Message('%1',Str2);
    

    What about this?
  • BeliasBelias Member Posts: 2,998
    your original question was:
    Can anyone let me know how to findout That String contains other than numeric ? ? ?
    and you got 3 answers.

    but you obviously need something else: so, what do you really need to do?what's the business need?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Belias wrote:
    your original question was:
    Can anyone let me know how to findout That String contains other than numeric ? ? ?
    and you got 3 answers.

    but you obviously need something else: so, what do you really need to do?what's the business need?

    Good question. :thumbsup:
  • hardik_shahhardik_shah Member Posts: 219
    Business Need is following

    I have one field and data type is COde. This field contain AlphaNumeric data in some records and contain Pure numeric data in some records.

    What will be Navision coding to find out that field has Numeric value or AlphaNumeric value.

    Because I want to dump only numeric records into some other field of Integer data Type.
    When I am Dumping Alphanumeric data into Integer data type fields is giving run time error.

    Need help.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    try
    str := 'ABC12AV';
    Str2 := DELCHR(Str,'=','0|1|2|3|4|5|6|7|8|9');
    Message('%1',Str2);
    

    What about this?

    Did you try this?
  • BeliasBelias Member Posts: 2,998
    try
    str := 'ABC12AV';
    Str2 := DELCHR(Str,'=','0|1|2|3|4|5|6|7|8|9');
    Message('%1',Str2);
    

    or easier
    myintegerfield := 0;
    if evaluate(myintegerfield,mycodefield) then
      // do something, a MODIFY, for example;
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • hardik_shahhardik_shah Member Posts: 219
    Hi,

    Thanks for your promt reply....

    This code has worked.................................... :D

    if evaluate(myintegerfield,mycodefield) then
    // do something, a MODIFY, for example;
Sign In or Register to comment.