Hi, I make a field lookup trigger which based on “No. 2” of “G/L Account”. Lookup trigger code : GLAccount.“No. 2”:=F109; IF FORM.RUNMODAL(FORM::“G/L Account List”, GLAccount,GLAccount.“No. 2”)=ACTION::LookupOK THEN F109:=GLAccount.“No. 2”; Everything is Ok except that the “G/L Account List” does not point to the specific record. Any idea for this. Thanks in advance.
This extract of code demonstrates how you can filter a List and retrieve the record selected. CaseAccountsDetails.SETRANGE(“Case No”, “Case No”); CaseAccountsForm.SETTABLEVIEW(CaseAccountsDetails); CaseAccountsForm.LOOKUPMODE(TRUE); IF CaseAccountsForm.RUNMODAL = ACTION::LookupOK THEN BEGIN CaseAccountsForm.GETRECORD(CaseAccountsDetails); VALIDATE(“Accounts Preparation Link”, CaseAccountsDetails.“Accounts Period End Date”); END; You can apply filters to a record and run a form based upon it using the form.settableview(record) call. You can retrieve the record selected from the list using the form.getRecord(record) call. Hope this answers the question.
Do it this way: GLAccount.SETRANGE("No. 2",F109); IF GLAccount.FIND('-') THEN ; GLAccount.SETRANGE("No. 2"); IF FORM.RUNMODAL(FORM::"G/L Account List",GLAccount,GLAccount."No. 2") = ACTION::LookupOK THEN F109 := GLAccount."No. 2";
quote:
Originally posted by nelson
Do it this way:GLAccount.SETRANGE("No. 2",F109); IF GLAccount.FIND('-') THEN ; GLAccount.SETRANGE("No. 2"); IF FORM.RUNMODAL(FORM::"G/L Account List",GLAccount,GLAccount."No. 2") = ACTION::LookupOK THEN F109 := GLAccount."No. 2";
Thanks Nelson it works. I don’t understand the way it works. Before run the form we reset the filters. How knows to point the specific record.
10 GLAccount.SETRANGE("No. 2",F109); 20 IF GLAccount.FIND('-') THEN ; 30 GLAccount.SETRANGE("No. 2"); 40 IF FORM.RUNMODAL(FORM::"G/L Account List",GLAccount,GLAccount."No. 2") = ACTION::LookupOK THEN 50 F109 := GLAccount."No. 2";
10: First we set a filter on the “No. 2” field from the GLAccount record variable. This filter takes the value present in field F109, the field on your table to where you need the contents of “No. 2” to be copied. 20: Then we try to FIND a record that matches the filter set in 10. If we didn’t check the return value of FIND, it would generate an error when no records were found. That’s why FIND is inside an IF control statement. Since we don’t need to do anything in case we FIND a record, we just do THEN ; This is, therefore, the step where our GLAccount record variable will be loaded with any record that has a matching “No. 2”. 30: Since we want the user to be able to see and select any other G/L Account, we remove the filter from “No. 2”. Remember, the record variable is still loaded with the correct record, if the FIND succeeded. 40,50: This part you already know… [:)] PS: MBS has only recently been started in Greece (just over a year ago, if I remember). How are things going over there?
Thanks for your detail information Nelson. In Greece we have 15 NSCs. Navision has recently localized for Greece. Our company “EFFECT” is a partner since Sep 2003. We have our first customer in Cyprus. There are other 5 customers in pre-sale phase. I am the only person in company with developer certification. The only serious competitor in Greece is SAP. I am positive about Navision in Greece. I think in 3 years it will be the only one. What about your country with Navision ?
We’ve had an official Navision/MBS subsidiary since 2000. There are around 20 partners and the last news I read indicated a growth above the market average. I am not very accurate on country info because I am an end-customer and not a partner. It’s easier to know the market when you are on your position.