开发者

maxof( fieldid2name( ... ) ) from tableid2name( ... )?

is it possible to get the current max-value of a column, only knowing tableID and fieldID in ax 2009? i know you can get several informations about the field like isMandatory or something, but i 开发者_如何学JAVAneed to know the maximum value instead...

thanks for any hints in advance!


No problem if you program your query, look at this job (AX 2009):

static void MaxValueTest(Args _args)
{
    str maxValue(TableId tableId, FieldId fieldId)
    {
        QueryRun qr = new QueryRun(new Query());
        qr.query().addDataSource(tableId).addSelectionField(fieldId, SelectionField::Max);
        return qr.next() ? any2str(qr.get(tableId).(fieldId)) : '';
    }
    ;
    info(maxValue(tableNum(CustTable), fieldNum(CustTable,AccountNum)));
}

One problem is the return type, which is solved by casting to string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜