Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Regarding fetching values from another table a form.

Posted on by 475

Hi guys,

Good Day.

I have customized sales order form.

In that, I have added a Tab.

That tab contains some fields namely,

Customer Balance- customer
Last Invoiced Date - sales invoice header
Last Payment Date-?
Total No. of Unpaid Invoices-?
Total Tax Amount- sales tax amount line
Total Line Amount- sales line
No. of orders from Quotes-?.

These are the fields that i have added to my form.

I have found where to get the values for some fields in the form which are on the right side of the field name.

But I don't know about the other fields,  please help me on this.

Here I tried for get last invoiced date field to get the value from the sales invoice header by adding the code on sell to the customer no validate the field in sales header table but its working.

My variables in the code are.

salesinv Record  sales invoice table

My code is "Last Posting date":= salesinv."Posting date";

But it doesn't seem to work.

Please advice.

Warm Regards,

Bharath K

*This post is locked for comments

  • bharathkarunakaran Profile Picture
    bharathkarunakaran 475 on at
    RE: Regarding fetching values from another table a form.

    Thanks for  your reply,

    Can anyone suggest me on how to get the other values in my form .

    PLease advice

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Regarding fetching values from another table a form.

    Hi Bharath,

    please use this code in sales Inv header Sell-to Customer No-on validation trigger

    SalesInvLine.RESET;

    SalesInvLine.SETRANGE("Sell-to Customer No.","Sell-to Customer No.");

    IF SalesInvLine.FINDLAST THEN

     BEGIN

    LastPostingDate:= "Posting Date";

       END;

    Thank you

  • bharathkarunakaran Profile Picture
    bharathkarunakaran 475 on at
    RE: Regarding fetching values from another table a form.

    Thanks suresh,

    But the code i tried it on sell-to customer no on validate trigger of the sales header table and also in the last invoiced date on validate trigger of the same table,but  it is not working .

    any advice please

    bharath

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Regarding fetching values from another table a form.

    Last payment Date  - Cust Ledg entry of type Payment

    Total No. of Unpaid Invoices -  Cust Ledg entry  of type invoice with Remaining Amount value

    No. of Order from Quotes - Sales header with Quote No. has value.

  • bharathkarunakaran Profile Picture
    bharathkarunakaran 475 on at
    RE: Regarding fetching values from another table a form.

    Hi suresh ,

    Thanks for your reply,

    Can you just tell where to find the remaining fields from the list above.

    thanks

    bharath K

    I will try what you have said and update the status.

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Regarding fetching values from another table a form.

    Bharath,

    You cannot just use SalesInv.Posting Date, you need to apply the filter to that record for that customer and get the record and then assign the value

    ex:

    salesInv.RESET;

    sa;esinv.SETRANGE("sell-to customer No.","Sell-to customer No.");

    if salesinv.findlast then

    "Last posting date" := salesinv."Posting date"

    some like that.

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans