X++ code to validate only numbers in string

Following job that illustrates how we can use regular expressions in axapta for validating only numbers in string.

static void TextBuffer_regularExpression(Args _args)

    TextBuffer txt = new TextBuffer();
    str msg = "98797897";

    txt.regularExpressions(true);   // activate regular expr in search

     // Regular expression to validate only digits
     if (txt.find("^[0-9]+$"))
        info("string contains only numbers");



  1. Dear raj i have 2 date fields i.e FromDate and ToDate and i have a requirement that i need to throw an error if FromDate is greater than ToDate. Please tell me how to do this.Thank You

  2. You can write logic in Table validate write method or Form DataSource ValidateWrite Method.


Note: Only a member of this blog may post a comment.