How to hide fields in report

Navi_LearnerNavi_Learner Member Posts: 356
I created a report on the sales invoice line table and some other tables. If I want to retrieve the item and its related price fieds, all the data(including the freight and set up and others and its related cost) are displayed in the report. My question is how to hide the fields I don't need.

Comments

  • SavatageSavatage Member Posts: 7,142
    Are these fields you want visible sometimes & others not depending on a scenario?

    Are these just extra fields you don't need? -.You can just delete them.

    Are these fields you don't need but don't want to get rid of "just in case"?

    you can change the fields proporties to Visible:No
  • Navi_LearnerNavi_Learner Member Posts: 356
    Thanks, Harry! It's not what I meant. For example we have the following fields, Item, Cost, and Quantity and the data are as follows:
    Item Cost Quantity
    Pen 5.00 100
    Imprinting30.00 90
    Shipping 12.00 1
    How to hide imprinting and shipping and its related data and generate the report like
    Item Cost Quanity
    Pen 5.00 100
    I tried to code with If condition, but it doesn't work. Thanks!
  • krikikriki Member, Moderator Posts: 9,118
    In the "OnPreSection()"-trigger of the section you don't want to print, you have to put
    CurrReport.SHOWOUTPUT(condition that returns TRUE or FALSE); //TRUE to show it and FALSE to hide it
    

    or

    In the "OnPreSection()"-trigger of the section you don't want to print, you have to put
    IF [I don't want to see it-condition] THEN
      CurrReport.SHOWOUTPUT(FALSE);
    

    or

    If you don't want to process the record at all (with previous examples, you process the report and you are able to show other sections of that record [mostly used to select between different layouts for a record (see Salesinvoice => printing the lines)])
    In the "OnAfterGetRecord()"-trigger:
    IF [I don't want to see it-condition] THEN
      CurrReport.SKIP;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Navi_LearnerNavi_Learner Member Posts: 356
    Thanks! Actually I know it, but when I use if conditions several times, it just hides one, but the rest of them are still displayed.
  • Navi_LearnerNavi_Learner Member Posts: 356
    :wink: Thanks, it works now. I have another question. I have another field total value, but it retrieves all the price, and I just want the total price of not hiding part, but the report still display all the amount including the shipping and imprinting. Thanks in advance!
  • krikikriki Member, Moderator Posts: 9,118
    :wink: Thanks, it works now. I have another question. I have another field total value, but it retrieves all the price, and I just want the total price of not hiding part, but the report still display all the amount including the shipping and imprinting. Thanks in advance!
    I suppose you use the CREATETOTALS-command or the "TotalFields"-property.
    It is better to create a global for it. You have to total it manually in the "OnAfterGetRecord"-trigger. But do it AFTER the SKIP-statement (if you used this one [this would be the best way to skip records]).

    Or if you put code in the "OnPreSection"-trigger, you have to subtract the value in case it shouldn't be shown. This because you added it in the "OnAfterGetRecord"-trigger. This is not really a nice programming style. In this case I would put a comment in the "OnAfterGetRecord"-trigger, saying the value will be subtracted in an "OnPreSection"-trigger in case the record has not to be shown.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Navi_LearnerNavi_Learner Member Posts: 356
    Thanks!
Sign In or Register to comment.