MAX Value

mrigyamrigya Member Posts: 124
Hi All
Can anybody tell me is there is any function like MAX in NAV, which can get the maximum value in the field of type decimal or integer.

Thanks and Regards
Mrigya Matoo

Answers

  • garakgarak Member Posts: 3,263
    do you need a function which returns the highest value are possible in an integer field or decimal field?

    like decimal = range between -999.999.999.999.999,99 - 999.999.999.999.999,99
    like integer = range between -2147483647 - 2147483647

    or the highest value are stored in your recs like under sql?
    select MAX(Field) from Table Where Condition
    
    Do you make it right, it works too!
  • mrigyamrigya Member Posts: 124
    I m not working on SQL ..i want this thing to be done in Navision.
  • idiotidiot Member Posts: 651
    Where do you need this? Report? Forms? Table?
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • leugimleugim Member Posts: 93
    hi
    there is not a specific function to return the maximum value of a field/data type, i think
    check the data type you are using to know the range
    if you want to know the max value in a field from a table, create a new key using your field and change your sorting using that key...

    regards
    _______________
    so far, so good
  • kinekine Member Posts: 12,562
    for integer you can use the integer table... for decimal, there is no way.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    In my meaning the integer Table has only stored the data between - 1000000000 and 1000000000
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    kine wrote:
    for integer you can use the integer table

    In my opinion the integer Table has only stored the data between - 1000000000 and 1000000000
    Do you make it right, it works too!
  • kinekine Member Posts: 12,562
    garak wrote:
    kine wrote:
    for integer you can use the integer table

    In my opinion the integer Table has only stored the data between - 1000000000 and 1000000000

    :oops:

    Thanks, never noticed that, never needed it... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    Flowfields have a MAX method - but it will kill performance if the table is big

    Couldn't you make your own function to loop thru the records
    if vMaxValue < "your integer"
    then vMAxValue := "Your Integer";

    at the end vMaxValue should have the largest #? :-k
  • DevDev Member Posts: 74
    No... Idea!!!
  • DevDev Member Posts: 74
    Hi....u try this...i wish it worked...

    Documentation()

    Sales Line - OnPreDataItem()
    MaxAmt := 0;

    Sales Line - OnAfterGetRecord()

    REPEAT
    Amt := "Sales Line"."Line Amount";
    IF Amt > MaxAmt THEN
    MaxAmt := Amt
    UNTIL "Sales Line".NEXT = 0;

    Sales Line - OnPostDataItem()
  • mrigyamrigya Member Posts: 124
    Thanks a Ton,its working Fine. :D
  • SavatageSavatage Member Posts: 7,142
    That solution looks familiar :lol:
    glad it works!
    Savatage wrote:
    Couldn't you make your own function to loop thru the records
    if vMaxValue < "your integer"
    then vMAxValue := "Your Integer";
    at the end vMaxValue should have the largest #? :-k
Sign In or Register to comment.