Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Thursday, February 18, 2021

GUID in AX 2012 / D365

 //< What is GUID>

// GUID 16 bit large range of alphanumeric similar to RecID to treat as primary key of a table.

static void CreateGUIDInAX(Args _args)

    str 60 strGuid;

    ;

    info(Winapi::createGUID());         // Creates GUID and removes the braces

    info(guid2str(newGuid()));           // Creates GUID with braces

    //NOTE: GUID is not a string so we needs to convert GUID to str for using...

}

Output:

C2B4FEBF-2393-43BB-9EA5-B173B907CA2A

{BAD14349-5837-4AC3-9B9B-9D6FB0F86BEC}

note: Your output and mine needs to be same.


Regards.

Monday, January 11, 2021

Round the decimals (upper / lower) in AX 2012 / D365

 Hi,


static void AlfRound(Args _args)

{

    Amount  amount = 5578.59;

    info(strfmt("Amount %1", amount)); // Printing the original values

    info(strfmt("Round,1  - %1", round(amount,1))); // This performs standard operation of round and removes the decimal.

    info(strfmt("roundDown,1 - %1", roundDown(amount,1)));  //Always round by down with ones position, if you make 100 then output will be 5,500.00

    info(strfmt("roundDownDec,1 - %1", roundDownDec(amount,1))); // Down rounding only the decimal values

    info(strfmt("roundUpDec,1 - %1", roundUpDec(amount,1))); //Up rounding only the decimal values

    info(strfmt("roundup,1 - %1", roundup(amount,1))); //Always round by down with ones position, if you make 100 then output will be 5,600.00

    info(strfmt("roundUp(roundUp,1) - %1", roundUp(roundup(amount,1),1))); // Roud the rounded amount will not make any changes in the rounded amount.

    info(strfmt("decround,1 - %1", decround(amount,1))); // It performs the standard operation of round in decimal 

}


Regards,

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...