How to make a Filter returning the 'max' value from a list?

SUGGESTED

I would like to make a filter returning the record with me max value, is there a way to do that?

In SQL I use this:

select MAX(NUM_0) from PINVOICE

Just a example, how I can do that in X3?

  • 0
    SUGGESTED

    Hi.

    For a filter, you would have to create a  Selection Action on the field and you would have to declare the title, and key value returned. To just return the value, call an action like this:

    $SPExxxVAL
    Local Integer I : I = 0
    Local Char REQUEST(255)(0..3)

    REQUEST(0) = "select MAX(NUM_0) from PINVOICE"


    For (Integer MAX) From "5" Sql REQUEST As [YLNK]
    I += 1
    [M:xxx]xxx = [F:YLNK]MAX
    If MAX = "" : I = 0 : End : Endif
    Next

    Return

  • 0

    Hi,

    if you can use an index it would be faster. In such a case, use "read [F:xxx]ind last" .

    Example : "read [F:POH]POH2 last" gives you the higher  date of purchasing orders