Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Help with dropdown list

Posted on by 5,124

I have created a table relation in a table column field and have also created the field group DropDown in the source table of the DDList.  Everything works great whereby I see the correct dropdown values and columns (it has 4 columns).  However, my current dilemma is on Validate of the DDList in the Page, I would like to retrieve column 1, 2 and 3.  Please help on how to retrieve the column values of the selected row in the DDList.

*This post is locked for comments

  • mbr Profile Picture
    mbr 5,124 on at
    RE: Help with dropdown list

    HI Khoa, I ended up using the lookup page as you mentioned because I can't really guarantee users will not create dup items in the sales line.  As much as I want to use DDLIST, because I can't capture the selected row and the column values on selection, lookup page had to suffice.  Thank you.

  • Verified answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Help with dropdown list

    Hi Mbr,

    Your table ABC should include Document No., Line No. to distinguish sales line (assume one Document Type) because they are PK fields of Sales Line table. Instead of using DDList, you can create a lookup page with needed visible columns for table ABC, and write code in OnLookup trigger of source field.

  • mbr Profile Picture
    mbr 5,124 on at
    RE: Help with dropdown list

    Yeah.  That's my dilemma.  Currently, we are not stopping users from entering item # that may already exist in the Sales Line.    I am using Sales Line table as the dropdown list.  The first column is Document No (I need this to determine which sales no they want to select).  Then I am also showing the line no and item no and qty.  My problem is I can't capture the 2nd, 3rd and 4th column values.  For now, I am just going to assume (or will tell my users) that item #s are unique given the document no and type=Item.  Then I can use the onvalidate trigger whereby I can filter the document no and item no.  Hopefully, you guys may have other ideas.  This is a non issue in .net.  huhu.  but so hard to capture in Nav.

  • Suggested answer
    Rajasekhar@MS Profile Picture
    Rajasekhar@MS 5,567 on at
    RE: Help with dropdown list

    Hi

    On the Validate of the ABC Sales Order Field, set the filters on the Sales line using ABC Document No. and ABC Item No. like below

    SalesLine.Setrange(Document No.,ABC.SalesOrderNo);

    SalesLine.Setrange(Item No.,ABC.Item No.);

    IF Salesline.FINDFIRST THEN

     Qty := SalesLine.Quantity;

    if there are multiple sales lines with the Same Item No. you will have the problem, so if it is possible use the Sales line as the dropdown list  

  • mbr Profile Picture
    mbr 5,124 on at
    RE: Help with dropdown list

    But I can't get to the value of the second column of the ddlist?  E.g., when users click onto the ddlist field, document no, line no, qty will show up.  When users select a record, it will only display the document no.  How can I retrieve the corresponding line no value?

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help with dropdown list

    you don't have to make it first column.

    you can get the quantity based on the document no. and line no. selected from the drop down list

  • mbr Profile Picture
    mbr 5,124 on at
    RE: Help with dropdown list

    Hi Mohana.  But this would mean I have to make Line No. as the first column in the field group DropDown, right?  I think I will affect other DDLists as most of the ddlists would require the Document No.  I believe, when I create the field Group DropDown in the Sales Line, that will apply to all ddlists when Sales Line is used as Table Relation.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help with dropdown list

    We have Line No. field in Sales Line table so based on that we can get the unique quantity only.

  • mbr Profile Picture
    mbr 5,124 on at
    RE: Help with dropdown list

    Hi Suresh,

    I have a Sales Order Field in table ABC which has a table relation to Sales Line.  In that Sales Order Field, i have also created a filter so records from Sales line will only show the ones where Table ABC.ITem No= SalesLine.Item No.  Also, I have created a field group called DropDown in the Sales Line Table that shows Document No, Line No, Item No, Description and Quantity.

    So in a Page where Table ABC is the source, the sales order field will show the DDlist that will show the Sales Line records using the Field Group above as display fields where SalesLInes.Item No = Table ABC.Item No.

    So this works great.  The problem is onvalidate of ABC.Sales Order field, I can't easily grab the quantity column.  In the Sales Order field, only Document No will display.  I actually need to filter record from Sales Line where Document No = Document No displayed in the sales order and Sales Line. ITem No = Item No selected.  I need to retrieve the corresponding Quantity.  It's okay if users are ONLY entering records with Unique Item Number in the Sales Line.  But what happens if there are actually two records with the same Document No and the same Item No?  this is where potential problem arises.

    In .net, we could easily grab the 3rd or 5th column value from the ddlist. But in Nav, I don't know an easy way to do this.

    The suggestion of Mahesh will only work if Sales Line consists of unique document and item numbers.

    Also, how do you upload screen shots here? :)

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Help with dropdown list

    It is little confusing your query, can you please try to explain it in more detail with some screenshots.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans