Alfasith AX

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

Tuesday, July 30, 2024

Group By and Max(Date) in SQL / disticnt (GROUP BY with MAX(DATE) [duplicate] )

 Hi,


Train    Dest      Time

1        HK        10:00

1        SH        12:00

1        SZ        14:00

2        HK        13:00

2        SH        09:00

2        SZ        07:00


Expected output

Train    Dest     Time

1            SZ      14:00 

2           HK      13:00


Distinct ( max(AccountingDate) and group by (SubLedgerVoucherDataAreaID) from GeneralJournalEntry )

 distinct (GROUP BY with MAX(DATE) [duplicate] )

/**************************/

SELECT GJE.SubLedgerVoucherDataAreaID, MAX(GJE.AccountingDate) as MaxDate

FROM GENERALJOURNALENTRY GJE

GROUP BY GJE.SubLedgerVoucherDataAreaID


Thanks,


Thursday, July 18, 2024

Iterate the container in D365 / AX 2012

 Hi,

static void HandlingContainerJob(Args _args)
{
    container contain;
    int i;
    str containstr;
    ;
    contain = ["DataAt1stPosition","DataAt2ndPosition"]; //Data will be inserted at position 1 and 2
    contain = Conins(contain,3,"DataAt3rdtPosition","DataAt4thPosition"); // from 3rd position onward
    contain = conins(contain,5,"DataAt5thPosition"); // now the data inserted in 5th position
    //or use this technique
 
    info (strFmt("Length of the container: %1", conLen(contain)));
    for (i=1; i <= conLen(contain); i++)
    {
        info (strFmt("container value %1 is %2", i, conPeek(contain, i)));
    }

}

Group By and Max(Date) in SQL / disticnt (GROUP BY with MAX(DATE) [duplicate] )

 Hi, Train    Dest      Time 1        HK        10:00 1        SH        12:00 1        SZ        14:00 2        HK        13:00 2        SH...