How to choose a value from another table

kldegrkldegr Member Posts: 13
I have a form with a record as its source.
In one field an item shall be stored and the user shall choose the value from the table "item".
In another field the user shall choose a bin from the table "Bin"...

If I have a source-table behind the form like in "Purchase Header" there is no problem to choose a vendor in the field "Buy-from Vendor No." but I have no idea how to solve this problem without a source-table.
I couln't find any previous post regarding this problem.
Thanks in advance.

Answers

  • ChinmoyChinmoy Member Posts: 359
    It looks like we are posting very basic questions in this forum nowadays.. what I understand from your question is what you will normally do with a TableRelation property of the child table. Again, which is a very basic stuff a NAV developer will learn in the beginning days...

    Am I getting something wrong here?
  • kldegrkldegr Member Posts: 13
    edited 2012-04-26
    If you can tell me a good book or a website where I can learn this basic stuff, I will be very thankful.

    But to make it clear: I have no source-table in that form, just a source-record.
    As I wrote, with a source-table like in "Purchase Header" there is no problem...

    Regards Klaus
  • dansdans Member Posts: 148
    Klaus,

    Do you have access to Navision PDF or a senior to teach you this ?
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • kldegrkldegr Member Posts: 13
    At the moment I have no access to a senior. In a few days I will.
    But we should have access in our company to all documents Microsoft provides.

    What would you reccomend?
  • SogSog Member Posts: 1,023
    As NAV developers, we've learned not to directly answer the question, but analyse it in it's context.
    If you are developing this form as training, then we are usually concerned about the lack of guidance, and recommend training and literature. Training options can be consulted at partner and customersource. Do mind that most trainings require a fee, although free trainings are available, but I have no personal experience with them. (Try googling NAV training)
    For documents, C/side introduction and C/side solution development (also knowns as DEV I & II) are the most complete training documents.

    If you are doing this for a customer, than we would be worried even more, because beginner implementations are usually very low quality and we would recommend you'd get help from a senior developer and/or (external) consultant. This is because the actual development (where you clearly don't have enough experience yet) is not the main skill. It's to design solutions in NAV which require experience and insight in NAV and it's workings (The business side of C/side).
    Little changes in code can create large problems in the program, and this does not only apply to the financial aspect.

    To answer your question:

    If your form has as source a record, then you have a sourcetable, because the record must belong to a table.
    Next is the fields you want to fill out. Because you failed to specify the type of record, I'm going to assume it's a custom table (50000+ range) and no relations have been specified.

    Relations for records are rarely specified on form level, but rather on table level. If you relate your fields to the respective sourcetables, (item and bin in your case), you'll be able to lookup and select your values.
    Please consult the fieldproperties to define the relation.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • rhpntrhpnt Member Posts: 688
    @klaus
    I don't really know what to think of your last post but you sure have to start from scratch. For the start read the Applications Designers Guide - included in the doc section of the NAV5 dvd. Then read as many white papers, technical guides and content docs as there are available on the Partnersource website. Paralell to that find a NAV professional who can guide you through different stages and modules of NAV. And then, depending on your capacity to absorb all of this, you may be ready to lay hands on a production database. Remember, modifying an ERP system is not like any other programming project. One small error and wrong numbers are posted into the wrong ledger. Companies rely on that data, make decisions, future plans - if this data is wrong, then...
  • DenSterDenSter Member Posts: 8,307
    Download the training material for the development courses to start with, and study them. Do all of the exercises (do not skip any of them) and you will know what to do with table relationships and lookup forms and basic things like that.

    Go to your boss and keep asking them when your senior will be there, and demand that you get proper support. If your senior is not available, make a fuss about it. If you're not getting that senior after 1 or 2 months, find a job at another NAV partner.
  • dansdans Member Posts: 148
    DenSter wrote:
    Go to your boss and keep asking them when your senior will be there, and demand that you get proper support. If your senior is not available, make a fuss about it. If you're not getting that senior after 1 or 2 months, find a job at another NAV partner.

    :thumbsup: :mrgreen:

    Especially if your boss want to send you to a customer immediately without getting any proper training.
    Microsoft Certified IT Professional for Microsoft Dynamics NAV

    Just a happy frood who knows where his towel is
  • kldegrkldegr Member Posts: 13
    To make my point more clear: I was talking about a form which is not bound to a table.
    Maybe I wasnt't able to express my problem properly.

    I was asking a senior developer in my company and he helped me to find a solution.

    Thanks to all of you who gave me advice...
  • DenSterDenSter Member Posts: 8,307
    Alright so the next thing you would do in this community is post what you ended up doing to solve your issue. That way, you give something back to the community.
  • kldegrkldegr Member Posts: 13
    I will do it asap.
  • kldegrkldegr Member Posts: 13
    How I did solve the problem:
    As I told I have an unbound form.
    To read a value from another table and put it into a Text Box, I had to set the property "AssistEdit" to "yes". (This was the key to the solution)
    Now I could write a short piece of code under "OnAssistEdit" to get the data I wanted:

    Bin.SETRANGE(Bin."Location Code", [LocationCode]); //get just the Bins for the wanted LocationCode
    IF FORM.RUNMODAL(0, Bin) = ACTION::LookupOK THEN //put the chosen Bin into the field "Bin Code" of the record "Item Journal Line" which is connected to the form
    "Item Journal Line"."Bin Code" := Bin.Code;

    Hope this short explanation will help.
Sign In or Register to comment.