Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

LookUp() function usage to calculate field value

(1) ShareShare
ReportReport
Posted on by 107
can you please explain how Lookup() works in Business Central AL Code?
I am trying to understand the following code:-
 
CalcFormula = Lookup(/Sales Shipment Header/./Shipment Date/ where(/No./ = field(/Last Shipping No./)));
 
According to my understanding,
This function will return Shipment Date. but how it is able to filter? I am not able to understand /where/ part.
one thing I am sure of ,the two fields inside where will have same datatype, one is from sales shipment header and other one will from Sales Header table as this code is from SalesHeader.dal
 
Can someone please explain me this?
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 Season 2 on at
    LookUp() function usage to calculate field value
    Hi, If you can use VLOOKUP in Excel, this part can be understood as finding Lookup value (3) in Lookup column (ID), and Sales Shipment Header.Shipment Date is Result.
     
    Hope this can give you some hints.
    Thanks.
    ZHU
  • Suggested answer
    Dustin Wolf Profile Picture
    Dustin Wolf 30 on at
    LookUp() function usage to calculate field value
    In this instance, the look up is going to a specific record, and since you have Sales Shipment Header . Shipment Date, the look up is specifically looking for that field from that record.

    the Where is basically telling the system the specifics.

    Where(  "No." (the sales shipment No.) = field(" Last Shipping No. ") (the field on the sales header) )
    this tells the calcformula that it has a 1 to 1 relationship.  So it knows how to pull that specific shipment, and the specific date.
     
     
    Dustin Wolf, MS
    Senior Developer
    Accent Software, Inc.
  • gdrenteria Profile Picture
    gdrenteria 13,057 Most Valuable Professional on at
    LookUp() function usage to calculate field value

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans