How to clear value just after it is printed?

gumwitka
gumwitka Member Posts: 34
Hi All,

How to clear value (here: BudgetQuantity) just after it is printed?
In section GroupFooter I group some jobs by companies and for each company I would like to have sum for BudgetQuantity visible

OnPostSection for this GoupFooter I wrote:
IF CurrReport.TOTALSCAUSEDBY = FIELDNO(Job.Company) THEN
CLEAR(BudgetQuantity);

But I keep receiving 0, because value cleared before it is printed.

What shall I do?

Answers

  • kine
    kine Member Posts: 12,562
    IF CurrReport.TOTALSCAUSEDBY = FIELDNO(Job.Company) THEN
    CLEAR(BudgetQuantity); 
    
    why there is this code? The purpose of this is not clear for me.

    OnPostSection

    This trigger should only be used to perform processing that has to do with the visual output of the report - not processing of data.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gumwitka
    gumwitka Member Posts: 34
    I need to clear this value for each company, otherwise for next company I will receive sum or all that were printed before.

    If I add this line OnPreSection the result is the same. I just put it OnPostSection because I thought that this way it will first show value then clear.
  • kine
    kine Member Posts: 12,562
    You can use CurrReport.CREATETOTALS(BudgetQuantity) to create sums per group like if it is field from the table (you just needs to assign the value in OnAfterGetRecord of the Dataitem and rest is on Nav. You just print the BudgetQuantity on the GroupFooter and you will have there sum for the group. It is same like if some field is in GroupTotalFields property of the dataitem.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gumwitka
    gumwitka Member Posts: 34
    it worked :!: Thank you Kamil \:D/
  • kine
    kine Member Posts: 12,562
    You are welcome!

    Please, shall you add the [SOLVED] prefix into the subject of your first post? Thanks. :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.