cursor on right record on Lookup

OfLightOfLight Member Posts: 7
Hello,
Lookup function doesn't work correctly every where in Navision !
In fact, From the Form 104 - Account Schedule, making lookup on the "Totaling" field doesn't bring the cursor on the right record when displaying the list of G/L accounts.

when controlling Table 85 - Acc. Schedule Line : field 5 - Totaling, these properties are set :
TableRelation =
IF (Totaling Type=CONST(Posting Accounts)) "G/L Account" ELSE IF (Totaling Type=CONST(Total Accounts)) "G/L Account"

ValidateTableRelation and TestTableRelation are now at <Oui> ! [= yes ! ]

in the other side, there is a code in the totaling textbox (in the form)

IF "Totaling Type" IN
["Totaling Type"::"Posting Accounts","Totaling Type"::"Total Accounts"]
THEN BEGIN
GLAccList.LOOKUPMODE(TRUE);
IF NOT (GLAccList.RUNMODAL = ACTION::LookupOK) THEN
EXIT(FALSE)
ELSE
Text := GLAccList.GetSelectionFilter;
EXIT(TRUE);
END;
EXIT(FALSE);

p.s. : I'm using french version

how to solve this please ?
Thank you for answers.
Do it your self

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Try this:
    Declare a glAcc record for table 15. THEN:

    IF "Totaling Type" IN
    ["Totaling Type"::"Posting Accounts","Totaling Type"::"Total Accounts"]
    THEN BEGIN
    GLAccList.LOOKUPMODE(TRUE);
    glacc.SETFILTER("No.",Totaling);
    IF glacc.FINDFIRST THEN BEGIN
      GLAccList.SETRECORD(glacc);
    
    IF NOT (GLAccList.RUNMODAL = ACTION::LookupOK) THEN
    EXIT(FALSE)
    ELSE
    Text := GLAccList.GetSelectionFilter;
    EXIT(TRUE);
    END;
    EXIT(FALSE);
  • OfLightOfLight Member Posts: 7
    Thank you Kapamarou, it works, i'm studying this solution.
    Simple and efficient =D>
    Have a good day sir
    Do it your self
  • kapamaroukapamarou Member Posts: 1,152
    You're welcome.

    Keep in mind that there other issues about this. For example, if the code does not specify which record to show, the form can open at the last record you were viewing the last time you opened it, or at the first record, or... depending on the properties you have setup on the form.
Sign In or Register to comment.