Hide field in reports

mbskapilmbskapil Member Posts: 43
Hi Everybody
I am generating a report where i am calculating item wise total output and total sale and i want to hide the item where total output and total sale is 0 so please guide me up how can i hide those item where the values are coming 0.
Ex:
Item: Total Output Total Sale
Item1: 54 4
Item2: 0 0
Item3: 9 0
Item4: 0 5
Item5: 0 0
Item6: 0 0
Item7: 9 0
Considering above example i want to hide Item2 , Item 5, Item 6

Comments

  • utouto Member Posts: 36
    CurrReport.SHOWOUTPUT(TotalOutput<>0 AND TotalSales<>0)
    

    it will display the section when both are not zero and hide section whenever both are zero.
  • easabanganeasabangan Member Posts: 114
    Try to use this code:

    On the Presection of the section you are showing put this code:
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SHOWOUTPUT(FALSE);
    

    or you can put this code after your codes in the OnAfterGetRecord of your Data Item.
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SKIP;
    
    No future at CPI
  • mbskapilmbskapil Member Posts: 43
    Hi
    I tried this code but it is not helping me still showing all the lines

    uto wrote:
    CurrReport.SHOWOUTPUT(TotalOutput<>0 AND TotalSales<>0)
    

    it will display the section when both are not zero and hide section whenever both are zero.
  • mbskapilmbskapil Member Posts: 43
    It is infact showimg an error
    that
    " Type Conversion is not possible as Integer and Decimal "

    uto wrote:
    CurrReport.SHOWOUTPUT(TotalOutput<>0 AND TotalSales<>0)
    

    it will display the section when both are not zero and hide section whenever both are zero.
  • mbskapilmbskapil Member Posts: 43
    Hi easa
    well itried these codes but still it's not helping me out. I mean still it is showing me all those lines with null values
    easabangan wrote:
    Try to use this code:

    On the Presection of the section you are showing put this code:
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SHOWOUTPUT(FALSE);
    

    or you can put this code after your codes in the OnAfterGetRecord of your Data Item.
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SKIP;
    
  • utouto Member Posts: 36
    CurrReport.SHOWOUTPUT((TotalOutput <> 0) and (TotalSales <> 0))
    

    Please put this code on presection trigger, it should work fine... \:D/
    Actually, this one is work as same as easabangan's :D
  • krikikriki Member, Moderator Posts: 9,118
    mbskapil wrote:
    It is infact showimg an error
    that
    " Type Conversion is not possible as Integer and Decimal "

    uto wrote:
    CurrReport.SHOWOUTPUT(TotalOutput<>0 AND TotalSales<>0)
    

    it will display the section when both are not zero and hide section whenever both are zero.
    Try this to avoid the error:
    CurrReport.SHOWOUTPUT((TotalOutput<>0) OR (TotalSales<>0))
    
    The best is to put some code in the OnAfterGetRecord if you decide you don't need the record. In the Presection, you put code in case you need the record for something but don't want to show the section.

    So better would be (if you don't want the record to show and don't need it for anything else:
    OnAfterRecord:
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SKIP;
    
    But in this place:are you sure you use the correct variables to test for 0?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • mbskapilmbskapil Member Posts: 43
    Hi uto
    Still it is not solving my purpose sa,e thing is happening , it is showing all the lines

    uto wrote:
    CurrReport.SHOWOUTPUT((TotalOutput <> 0) and (TotalSales <> 0))
    

    Please put this code on presection trigger, it should work fine... \:D/
    Actually, this one is work as same as easabangan's :D
  • mbskapilmbskapil Member Posts: 43
    Hi kriki
    I am trying this but it is not helping me out
    kriki wrote:
    mbskapil wrote:
    It is infact showimg an error
    that
    " Type Conversion is not possible as Integer and Decimal "

    uto wrote:
    CurrReport.SHOWOUTPUT(TotalOutput<>0 AND TotalSales<>0)
    

    it will display the section when both are not zero and hide section whenever both are zero.
    Try this to avoid the error:
    CurrReport.SHOWOUTPUT((TotalOutput<>0) OR (TotalSales<>0))
    
    The best is to put some code in the OnAfterGetRecord if you decide you don't need the record. In the Presection, you put code in case you need the record for something but don't want to show the section.

    So better would be (if you don't want the record to show and don't need it for anything else:
    OnAfterRecord:
    IF (TotalOutput = 0) AND (TotalSale = 0) THEN
       CurrReport.SKIP;
    
    But in this place:are you sure you use the correct variables to test for 0?
  • easabanganeasabangan Member Posts: 114
    Where do you put this codes?

    These codes surely works.
    No future at CPI
  • mbskapilmbskapil Member Posts: 43
    Hi Easa


    Item.SETRANGE(Item."Inventory Posting Group",Item."Inventory Posting Group"::FG);
    ILE.SETRANGE(ILE."Item No.",Item."No.");
    "Total Output":=0;
    "Total Sale":=0;
    ILE.SETFILTER(ILE."Posting Date",'>=%1',"Start Date");
    ILE.SETFILTER(ILE."Posting Date",'<=%1',"End Date");
    IF ILE.FIND('-') THEN BEGIN
    REPEAT
    IF ILE."Entry Type"=ILE."Entry Type"::Output THEN BEGIN
    "Total Output":="Total Output"+ILE.Quantity;
    END
    ELSE IF ILE."Entry Type"=ILE."Entry Type"::Sale THEN BEGIN
    "Total Sale":="Total Sale"+ILE.Quantity;
    END;
    UNTIL ILE.NEXT=0;
    CurrReport.SHOWOUTPUT(("Total Output"<>0)AND ("Total Sale"<>0))
    END;

    this is my code
    now tell me
  • easabanganeasabangan Member Posts: 114
    on what trigger of the report did you place this codes?

    Try to use this code
    Item.SETRANGE(Item."Inventory Posting Group",Item."Inventory Posting Group"::FG);
    ILE.SETRANGE(ILE."Item No.",Item."No.");
    "Total Output":=0;
    "Total Sale":=0;
    ILE.SETFILTER(ILE."Posting Date",'>=%1',"Start Date");
    ILE.SETFILTER(ILE."Posting Date",'<=%1',"End Date");
    IF ILE.FIND('-') THEN BEGIN
      REPEAT
        IF ILE."Entry Type"=ILE."Entry Type"::Output THEN BEGIN
          "Total Output":="Total Output"+ILE.Quantity;
        END
          ELSE IF ILE."Entry Type"=ILE."Entry Type"::Sale THEN BEGIN
            "Total Sale":="Total Sale"+ILE.Quantity;
          END;
      UNTIL ILE.NEXT=0;      
    END;
    
    IF ("Total Output" = 0) AND ("Total Sale" = 0) THEN
       CurrReport.SKIP;
    
    No future at CPI
  • krikikriki Member, Moderator Posts: 9,118
    Item.SETRANGE(Item."Inventory Posting Group",Item."Inventory Posting Group"::FG); //This command does nothing without a FIND

    // In this place you should have 1 item (I don't know about the rest of the report, but if there is nothing else, I would make a dataItem on Table Item and put the code in the "OnAfterGetRecord" of the item-dataitem)
    "Total Output" := 0;
    "Total Sale" := 0;
    ILE.RESET;
    ILE.SETCURRENTKEY("Item No."); // without this, the REPEAT-UNTIL searches the whole table!
    ILE.SETRANGE("Item No.",Item"No.");
    ILE.SETRANGE("Posting Date","Start Date","End Date"); // if you use the 2 SETFILTERS on "Posting Date", the second filter cancels the first
    IF ILE.FIND('-') THEN
      REPEAT
        IF ILE."Entry Type" = ILE."Entry Type"::Output THEN BEGIN
          "Total Output" := "Total Output" + ILE.Quantity;
        END
        ELSE IF ILE."Entry Type" = ILE."Entry Type"::Sale THEN BEGIN
          "Total Sale" := "Total Sale" + ILE.Quantity;
        END;
      UNTIL ILE.NEXT = 0;
    IF ("Total Output" = 0) AND ("Total Sale" = 0) THEN
      CurrReport.SKIP;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • mbskapilmbskapil Member Posts: 43
    Easa
    I am writing my codes using curreport property on pre section trigger and if i use at on after get record then then i am using skip function but no solution is made yet

    easabangan wrote:
    on what trigger of the report did you place this codes?

    Try to use this code
    Item.SETRANGE(Item."Inventory Posting Group",Item."Inventory Posting Group"::FG);
    ILE.SETRANGE(ILE."Item No.",Item."No.");
    "Total Output":=0;
    "Total Sale":=0;
    ILE.SETFILTER(ILE."Posting Date",'>=%1',"Start Date");
    ILE.SETFILTER(ILE."Posting Date",'<=%1',"End Date");
    IF ILE.FIND('-') THEN BEGIN
      REPEAT
        IF ILE."Entry Type"=ILE."Entry Type"::Output THEN BEGIN
          "Total Output":="Total Output"+ILE.Quantity;
        END
          ELSE IF ILE."Entry Type"=ILE."Entry Type"::Sale THEN BEGIN
            "Total Sale":="Total Sale"+ILE.Quantity;
          END;
      UNTIL ILE.NEXT=0;      
    END;
    
    IF ("Total Output" = 0) AND ("Total Sale" = 0) THEN
       CurrReport.SKIP;
    
  • easabanganeasabangan Member Posts: 114
    Try reading documentations about navision on this sites, it will really help you, and try searching about triggers.

    http://www.waldo.be/modules.php?
    http://www.abc-computers.com/downloads/downloads.htm
    http://www.geocities.com/navision_attain/downloads.html
    No future at CPI
Sign In or Register to comment.