Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

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

Posted on by 184
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 64,134 Super User 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 184 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 184 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 263 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

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans