AX2012 X++ Code to read csv file


// Create  a new job and paste the below code

static void RB_ReadCsvFile(Args _args)
{
    #File
    IO  iO;
    CustAccount custAccount;
    CustName custname;
    FilenameOpen        filename = "C:\\Desktop\\RB.csv";
    Container           record;
    boolean first = true;

    ;

    iO = new CommaTextIo(filename,#IO_Read);
    iO.inFieldDelimiter(';');
 
    if (! iO || iO.status() != IO_Status::Ok)
    {
        throw error("@SYS19358");
    }
    while (iO.status() == IO_Status::Ok)
    {
        record = iO.read();
        if (record)
        {
            if (first)  // to exclude the header
            {
                first = false;
            }
            else
            {
                custAccount = conpeek(record, 1);
                custname = conpeek(record, 2);
                info(strfmt('%1--%2',custAccount,custname));
            }
        }
    }
}

AX2012 X++ Code validate the email id


// Create a job and paste the below code ..

static void RB_validateEmail(Args _args)
{
   
    Str     email;
    Str     MatchEmailPattern =@"\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b";
    System.Text.RegularExpressions.Match myMatch;
   
    ;
    email = "rameshAX2012@gmail.com";
    myMatch = System.Text.RegularExpressions.Regex::Match(email, MatchEmailPattern);

    if (myMatch.get_Success())
        info(strFmt("%1 is an valid email id ", email));
    else
       info(strFmt("%1 is not an valid email id ", email));
}

AX2012 X++ code to combine the folder path


// Create a job and paste the below code



static void RB_PathCombine(Args _args)
{
    str         path1 = @"C:\TestDir";
    str         path2 = @"C:\TestDir\";
    str         path3 = "MyFolder";
    str         combination;


    combination = System.IO.Path::Combine(path1, path3);
    info (strFmt("Combinig '%1' with '%2' gives '%3'", path1, path3, combination));

    combination = System.IO.Path::Combine(path2, path3);
    info (strFmt("Combinig '%1' with '%2' gives '%3'", path2, path3, combination));
}

AX2012 X++ code to read the text file

//Create a new job and paste the code
static void RB_ReadTextFile(Args _args)
{
    Filename                                              filename = @'C:\Desktop\AX2012.txt';
    System.IO.StreamReader          reader;
    System.String                                   line;
    InteropPermission                       interopPermission;
    Str                                                         text;

    interopPermission = new InteropPermission(InteropKind::ClrInterop);
    interopPermission.assert();

    reader = new System.IO.StreamReader(filename,System.Text.Encoding::get_UTF8());
    line = reader.ReadLine();

    while (!System.String::IsNullOrEmpty(line))
    {
        line = reader.ReadLine();
        text = line;
        info(strfmt("%1", text));
    }

    reader.Close();
    reader.Dispose();
}

AX2012 X++ Code to generate dates for one year

// Create a new job and paste the below code

static void RB_OneYearDate(Args _args)
{
    int           month,day,x,years,i,j,k;
    TransDate     preDate,nextmonth,monthStart,startdate,enddate,nextdate;

    ;

    years = year(systemdateget());
    for (i=1;i<=12;i++)
    {
      month = 0;
      nextmonth = mkDate(1,month+i,(years));
      enddate = endmth(nextmonth);
      day = dayofmth(enddate); 
     
      for(j=1; j<=day; j++)
      {
         month = mthofyr(nextmonth);
         nextdate = mkDate(j,month,(years));
         info(strfmt("%1",nextdate));
      }
    }
}

Install and Configure Zpl Printer on D365 F&O

  Setup Zpl Printer On D365 F&O Posted on Recently, I have had an opportunity review the possibilities to print license plates within D3...