Thursday, June 17, 2010

min and max in ax

Use minof and maxof to find minimum and maximum values of a table field. minof finds the minimum value of a specific field and maxof finds the maximum value of a specific field.

here's the example below.

LedgerTrans ledgerTrans;

select minof(TransDate) from ledgerTrans;

info(strfmt('%1', ledgertrans.TransDate));

select maxof(TransDate) from ledgerTrans;

info(strfmt('%1', ledgertrans.TransDate));


equivalent SQL queries for minimum and maximum date respectively.

select min(transdate) from LedgerTrans

select max(transdate) from LedgerTrans

1 comment:

  1. How, use minof and maxof transdate with QueryBuildDataSource?
    I have query, i try in Job and success.

    static void Test(Args _args)
    {
    smmActivities _smmActivities;
    ;

    while select maxOf(ActualEndDateTime) from _smmActivities
    info(strFmt("%1", _smmActivities.ActualEndDateTime));
    }

    But, how if in QueryBuildDataSource?
    Please help me..
    Thanks

    ReplyDelete