Options

OnFind Trigger

AngeloAngelo Member Posts: 180
OnFindRecord trigger I alway see this codes :

IF FIND(Which) THEN
EXIT(TRUE)
ELSE BEGIN
SETRANGE("No.");
EXIT(FIND(Which));
END;

What is the meaning of codes above?I dont understand. what value of Which?Anyone can help me to explain it in detail?

Comments

  • Options
    Christian_BuehlChristian_Buehl Member Posts: 145
    This code means:
    Find(which) tries to get the record defined by "which" ( '-' first record, '+' last record, '>' next record ...)
    If a record was found, the function returns with true, while the record pointer has moved to the found record.

    If no record was found, the filter set on the field "No." is cleared. (setrange without limits).
    Then it tries to find again the 'which'. Finally the result of the find command ist returned (true if found, false if not found)


    Be aware that in this case only filters on "No." are cleared. Any other filters will remain and are not affected.
    =D>
  • Options
    AngeloAngelo Member Posts: 180
    Chris,Thanks for your explanation....

    I have a problem pertain OnFind trigger

    When I press F5 ( looking List table ) there is Document No(e.g PR001) on the list form but after I click OK then error : "PR001 does not exist in the table Header". It is very Odd. On list form and on table Exist but When I look at my form will show error for the document no. Anyone hav ever got same problem with me? Anyone can help me?
    ](*,) ](*,) ](*,)
  • Options
    WaldoWaldo Member Posts: 3,412
    I think you'll have to debug this one ... . I've had the some kind of error when I put a CurrForm.UPDATE too many :-$ (I don't say, off course, this is the case with your problem ...).

    Is it default code, or customized?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    AngeloAngelo Member Posts: 180
    I have debugged it, and I have found the problem is :

    In my Table Line (subform) has field type flowfield sum quantity from Transfer line field quantity. if in Transfer line with doc no (PR001) hav been posted,It will show error like my email before. maybe I have to delete doc no(PR001) in my new table after posting Transfer header with the doc no(PR001). Any suggestion? is there other way without delete doc no in my new table although Transfer header has been posted? :roll:
  • Options
    WaldoWaldo Member Posts: 3,412
    If I understand correctly, it is customized code.

    Problem is ... i don't understand at all what you are trying to do, so it's difficult to give you advice on this one ... sorry ... :oops: :(

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • Options
    Christian_BuehlChristian_Buehl Member Posts: 145
    I acknowledge to Waldo, for doing some debugging.
    It's not very likely that your problem is the shown find routine, but anything else (or may be you need to do clear more or all filters with reset when nothing was found).
    Check out with the debugger whats happening and what filters are set when the problem occurs.
    :-k
Sign In or Register to comment.