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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

EXTENSTION GET UNIT PRICE FROM RESOURCE TABLE AND ASSIGN TO VARIABLE TO CALCULATE TOTAL PRICE

(0) ShareShare
ReportReport
Posted on by

Hi All 

I am new to AL programming and requires some help in the follwing query , i need to get the unti price from Resouce table and assinge to Varibable for Further calculation and dispalyin on the Assembly line sub form.

its erroring in the part 

                SELECT "Unit_Price"
                FROM "Resource"
                WHERE "Resource ID" = varResourceID
                INTO varUnitPrice;
Here is the full code 
pageextension 50003 PageExtension50003 extends "Assembly Order Subform"
{
    layout
    {
        addafter("Unit Cost")
        {
            field("ZY Resource Unit Price"; Rec.ZY_ResourceUnitPrice)
            {
                ApplicationArea = All;
               
            }
            field("ZY Resource Margin92783"; Rec.ZY_ResourceMargin)
            {
                ApplicationArea = All;
            }
            field("ZY Total Price"; Rec.ZY_TotalPrice)
            {
                ApplicationArea = All;
            }
        }
    }

    var
        varResourceID : Code[20] ;
        varUnitPrice: Decimal;
        varQuantity : Decimal;
        UpriceTot : Decimal;

    trigger OnNewRecord(BelowxRec: Boolean)
    begin
        varResourceID := Rec."No.";
        varUnitPrice := 0;
        varQuantity := Rec.Quantity;
        UpriceTot := 0;
 
   
                SELECT "Unit_Price"
                FROM "Resource"
                WHERE "Resource ID" = varResourceID
                INTO varUnitPrice;

        UpriceTot := varUnitPrice * varQuantity;
        Rec.ZY_ResourceUnitPrice := varUnitPrice;
        Rec.ZY_TotalPrice := UpriceTot;
    end;
 
 


}

Appriciate your experties and time and Tahks in Advanced. 

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    Thanks.

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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,556 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 877 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans