Skip to main content
Business Central forum
Answered

Columns in a table is non-zero, but printing them in BC make them zero

editSubscribe (0) ShareShare
ReportReport
Posted on by 479

In the Sales Invoice Header table, there are these Amounts for a specific customer:
21.PNG

I have this code that will collect each of those remaining amounts.
1602.PNG
Upon running it the column values for "amount" show up as 0 when Messaging/Printing to BC.
24.PNG

But when printing out the Sales Invoice No. (referring to table picture above), it messages the number just fine:
5504.PNG it grabs the correct posted invoices

Is there something wrong with my logic here?
I am working on a report extension for the Customer Statement report.

Attachments
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 59,978 Super User on at
    RE: Columns in a table is non-zero, but printing them in BC make them zero

    Hi, These fields are FlowFields, which are not really data in the table. They will be recalculated when the page is opened.

    There are two ways when you want to use its value.

    Record.CalcFields: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-calcfields-method

    Record.SetAutoCalcFields: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-setautocalcfields-method

    More about FlowFields: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-flowfields

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: Columns in a table is non-zero, but printing them in BC make them zero

    Hi jdrco ,

    Please use below code inside the repeat..until

    salesinvHeaderRec.Calcfields(Amount);

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,080 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,601 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans