How to return key on drop down lookup on RTC

cyuwonocyuwono Member Posts: 28
edited 2012-08-29 in NAV Three Tier
Hi There,

I am wondering if it's possible to return/get record from drop down lookup, on a table that has multiple keys.

For example my "post code" table primary key is Code, Street Name and City.

On the customer page I have drop down on "post code" field but this will only return the code not the street or city.

What I am trying to do here is to populate the street name and city when user enter/select the post code on the text box, but to do this I need to know which field the user selected otherwise I will not be able to fetch the record.


Thank you
Carlos Yuwono

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Where do you want to update the street and city? on the same Post Code field or other fields?
  • mihail_kolevmihail_kolev Member Posts: 379
    I don't think so. The standard lookup returns the value of the field that is specified in the TableRelation property of the field in your table.
    -Mihail- [MCTS]
  • cyuwonocyuwono Member Posts: 28
    Where do you want to update the street and city? on the same Post Code field or other fields?

    Other field.... on the Customer/Contact card. The idea is to speed up the data entry process. The user will select or enter the post code and the system will automatically fill in the rest of the address fields (address line one, two, city, and province) and the only field left for the user to type in is the house number or apt unit.


    Post Code : user select customer's post code from the drop down
    Address 1 : Auto fill based on the selected post code
    Address 2 : Auto fill based on the selected post code
    City : Auto fill based on the selected post code
    Province : Auto fill based on the selected post code


    I thought this will be easy to solve ](*,)
    Carlos Yuwono
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    City will be updating now also from Post Code table I guess.
    where do you want to get Address fields?
  • cyuwonocyuwono Member Posts: 28
    City will be updating now also from Post Code table I guess.
    where do you want to get Address fields?


    Yes from post code table.
    I have the following fields on my post code table

    Field No. Field Name
    1 Code
    2 City
    3 Search City
    10010 County
    50000 Province Name
    50001 Area Name
    50002 Street Name
    50003 Street Type Code
    50004 Street Dir Code
    50005 Street Seq Code
    50006 Street From No
    50007 Street From Suffix
    50008 Street To No
    50009 Street To Suffix



    We bought the post code database and we loaded up in navision.
    Carlos Yuwono
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Is City updating now?

    In table 225 - Post Code - Function ValidatePostCode
    Write below code under
    PostCode := PostCodeRec.Code;
    City := PostCodeRec.City;
    Address 1 := PostCodeRec.<field from post code table>
    Address 2 := PostCodeRec.<field from post code table>
    Province := PostCodeRec.<field from post code table>
    
  • cyuwonocyuwono Member Posts: 28
    I am trying to auto fill the customer table not the post code table.

    Let's say you are entering your customer information. Instead of entering the street name, city and Province, you would enter the postal code first.
    When you enter the post code the program lookup on the post code table and return the street name, city and province and it will automatically place those information on the appropriate text box on the customer card. What's left now is to enter the street number and unit number.

    The reason I am doing this is to speed-up the data entry process.

    When the postal code is unique, there is problem returning those information.
    I can simply use these code on the "on validate" - post code field on the customer page


    rec = Customer
    PostCode.setfilter(Code,"post code entered by user");
    IF PostCode.findfirst THEN BEGIN
    
       Address := PostCode.StreetName;
       City := PostCode.City;
       Province := PostCode.Province;
    
    END;
    


    The problem is when there are 2 or more streets shared the same post code, in this case I wont be able to use findfirst to fetch the record. The alternative way to do it is to show the lookup pop up windows but I am trying to avoid pop up window... I really like how the dropdown works, it's clean and sleek.


    Is there away to filter the dropdown in code ? I've been searching over the internet but it seems that there is no way to filter the dropdown based on the variable value.
    http://www.kauffmann.nl/blog/index.php/2011/10/17/controlling-the-drop-down-list-in-the-roletailored-client/
    Carlos Yuwono
Sign In or Register to comment.