Skip to main content

Notifications

Business Central forum
Answered

Copy Calculated Field Value to another Decimal column just as a value.

Posted on by 256
Hi,
 
Using Item Table as sample, As your aware, Inventory is a calculated flow field. if i was to create another Field inside the items table and wanting to transfer the value from Inventory to the new field.
 
understanding that each timewe go to the page, it will need to update. this can be handled on the events. How do i transfer the value across? 
 
i thought it was this but i get nother back.:
 
    local procedure UpdateInvST(ItemNo: Code[20])
    var
        Item: Record Item;
    begin
        if Item.Get(ItemNo) then begin
            Item.CalcFields(Inventory);
            Item.InvST := Item.Inventory;
            Item.Modify();
        end;
    end;
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 69,202 Super User 2024 Season 2 on at
    Copy Calculated Field Value to another Decimal column just as a value.
    Hi, hope the following helps.
     
    Thanks.
    ZHU
  • Netjacker2097 Profile Picture
    Netjacker2097 256 on at
    Copy Calculated Field Value to another Decimal column just as a value.
    @Tech_BC_Gokul, i have tried below still not taking the value from inventory to InvST:
        trigger OnAfterGetRecord()
        begin
            if Rec.Get(Rec."No.") then begin
                InvST := 0;
                Rec.CalcFields(Inventory);
                InvST := Rec.Inventory;
            end;
        end;
     
        var
            InvST: Decimal;
  • Netjacker2097 Profile Picture
    Netjacker2097 256 on at
    Copy Calculated Field Value to another Decimal column just as a value.
    Thanks, will try it now.
     
    M
  • Suggested answer
    Tech_BC_Gokul Profile Picture
    Tech_BC_Gokul 267 on at
    Copy Calculated Field Value to another Decimal column just as a value.
    Hi 
     
    You can try this method instead of field use a variable in Page 
     
    In Page OnAfterGetRecord
     
          if Item.Get(ItemNo) then begin
             InvST:= 0;
             Item.CalcFields(Inventory);
             InvST:= Item.Inventory;
            end;
     
    This variable need to initalzed global. 

    Thanks
    Gokulnath

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,451 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,353 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans