web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

getting value from another table, based on value

(0) ShareShare
ReportReport
Posted on by

on item no validate in courier table, im having this below code and works fine


IF item.GET("item No") THEN
DealerPrice:=item.DealerPrice;
VATIdent:=item."VAT Prod. Posting Group";

VATident value here is VAT14.5

how to map the VATident = VAT Posting Setup.VAT Prod. Posting Group

and get the value of the VAT % and store this value in courier.VAT% field..

any ideas.. thanks






*This post is locked for comments

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    Please try yourself and let us know if you have any issues.

    please don't ask forum to do your job.

  • Community Member Profile Picture
    on at

    yes sure, thanks im trying this on, and im sure this wrong..

    VATIdent - OnValidate()

    //IF VATPosting.GET("VATIdent") THEN ( i dont know, how to search a field in the  .VAT Prod. Posting Group)

    //"VAT%":=VATPosting."VAT %";

  • Verified answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    1. if you multiple lines below IF THEN. Please use begin and end

    IF item.GET("item No") THEN BEGIN

     DealerPrice:=item.DealerPrice;

     VATIdent:=item."VAT Prod. Posting Group";

    END;

    2. You have written code in VATIdent onvalidate trigger.

    so you have to validate the field in 1st code.

    VALIDATE(VATIdent,item."VAT Prod. Posting Group");

    3. In order to use GET on VATPosting setup, you need to know all primary keys

    Primary key of Vat Posting setup table is VAT Bus. Posting Group,VAT Prod. Posting Group

    so you need VAT Bus. Posting Group

  • Suggested answer
    Community Member Profile Picture
    on at

    IF item.GET("item No") THEN  BEGIN

    DealerPrice:=item.DealerPrice;

    VATIdent:=item."VAT Prod. Posting Group";

    END;

    VATPosting.RESET;

    VATPosting.SETCURRENTKEY("VAT Prod. Posting Group");

    VATPosting.SETRANGE("VAT Prod. Posting Group",VATIdent);

    IF VATPosting.FINDFIRST THEN    BEGIN

     VATPer:= VATPosting."VAT %"

    END

    and it worked.. thanks for your support....

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    and what if you have multiple lines for VATIdent?

    do you always need first record VAT% only?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans