Prevent Rpt certain sections from printing

Sapphire123Sapphire123 Member Posts: 112
Hi All,

I'm trying to prevent a report from printing DataItem A section results based on dataitem B's 'create total' results... (where, dataitem B is nested in dataitem A)

The only way to test 'createtotal' results for variables in Dataitem B is in the 'OnPostSelection' of the Footer section of Dataitem B... but, by the time this section is reached, every section of Dataitem A is printed.

any idea how to work around this situation?

Thanks in advance!

ps. 'PrintOnlyIfDetail' does not work since, Dataitem B will always have detail to print.

Comments

  • KarenhKarenh Member Posts: 209
    In the pre-section of the section which you want conditionally to print, you need to write code to calculate the totals.

    Then, still in the pre-section, you need to have:

    CURRREPORT.SHOWOUTPUT(your condition here);
  • kinekine Member Posts: 12,562
    Or you can move all the controls from DataItem A body section into DataItem B footer section. It will be printed for each entry in the DataItem A but you will know the result already. But it means that the data will be under data from DataItem B. If you need to have them as first, you need to check the sum before DataItem B is processed as Karenh wrote...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Sapphire123Sapphire123 Member Posts: 112
    Thanks for the replies ...

    I'm trying to modify Nav's standard report #10138 - so that when all columns are printing '0' for a certain item, nothing prints.

    How do i calculate totals? 'CreateTotals' function can only be used from a dataitem trigger. i'm getting an error when i try to put this in the pre section of the footer ... :?

    //
    Code - start

    CurrReport.CREATETOTALS(InventoryValue,TotalExpectedCost,TotalInvoicedValue,
    ShippedNotInvoiced,ReceivedNotInvoiced,NetExpectedCostNotPosted,
    ShippedNotInvoicedPosted,ReceivedNotInvoicedPosted,NetExpectedCostPosted);
    CurrReport.CREATETOTALS(InvoicedValueNotPosted,InvoicedValuePosted);


    if (InventoryValue = 0 and Total Expected Cost = 0 .... etc) then
    DoNotPrint = True;

    CurrentReport.Showoutput(NOT DoNotPrint);

    //
    Code - end

    Thanks in advance..
  • kinekine Member Posts: 12,562
    You need to "simulate" what the report is doing in the nested dataitem. I do not know the report because it is just for US.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    A few comments.

    The only way I find everything Zero is if it's a zero cost item to begin with.

    IF that is the case you can set the filter on the item tab to not include unit Cost of Zero.

    If you're using Print Details. If you View-> Sections And look at the code on Item Ledger Entry Body(3) that's where you can put your code - See it already has the code there for Details Or Not..
    OnPreSection()
    CurrReport.SHOWOUTPUT(ShowDetails);
    
    You can add yours too to stop Zero Inventory Valuation Items well.

    You want to set this on the sections of the report not from the dataitems Unless you want to use CurrReport.SKIP;

    It need to be at the end since the first code already set's everything to zero...

    InventoryValue := 0;
    InvoicedValue := 0;
    InvoicedValueACY := 0;
    InvoicedPostedToGL := 0;
    InvoicedPostedToGLACY := 0;
    InvoicedQty := 0;
    ValuedQty := 0;
    ExpectedValue := 0;
    ExpectedValueACY := 0;
    ExpectedPostedToGL := 0;
    ExpectedPostedToGLACY := 0;
  • SavatageSavatage Member Posts: 7,142
    kine wrote:
    I do not know the report because it is just for US.
    Here's a peek at my copy if your interested.
    http://savatage99.googlepages.com/10138 ... oncile.txt
  • Sapphire123Sapphire123 Member Posts: 112
    thanks for the suggests, i'll try it out.
  • Sapphire123Sapphire123 Member Posts: 112
    Savatage wrote:
    The only way I find everything Zero is if it's a zero cost item to begin with.

    IF that is the case you can set the filter on the item tab to not include unit Cost of Zero.

    I tried to filter for items where Unit Cost is <>0.. but, it still gives me everything.

    I'm trying to see if the total for Inventory Valuation, Received Not Invoiced, Shipped Not Invoiced etc... is zero for an item. if so, then I do not want to print anything for this item.
  • Sapphire123Sapphire123 Member Posts: 112
    Savatage wrote:
    If you're using Print Details. If you View-> Sections And look at the code on Item Ledger Entry Body(3) that's where you can put your code - See it already has the code there for Details Or Not..
    OnPreSection()
    CurrReport.SHOWOUTPUT(ShowDetails);
    
    You can add yours too to stop Zero Inventory Valuation Items well.

    You want to set this on the sections of the report not from the dataitems Unless you want to use CurrReport.SKIP;

    It need to be at the end since the first code already set's everything to zero...

    Yes, thats another thing that i was trying.. however, on predata section, the totals are not calculated.. its only after this trigger is run do i get a value for the variables..
    what do you mean by ' it needs to be at the end..' ? End of which section? Please elaborate.

    Thanks again..
Sign In or Register to comment.