Conditional Labels In a Report

RGRG Member Posts: 9
edited 2004-06-18 in Navision Attain
I am working on creating a new invoice which will have three labels: Unit Price Base, Discount, and Unit Price. The Unit Price Base is the selling price, the discount is the discount and the Unit Price is the net of the two. I am trying to set it up to only show the Unit Price Base and Discount if there is an item on the invoice that gets a discount, otherwise only the last label will show. The discounts are actually Line Discounts. I set up a variable TotalLineDiscount := TotalLineDiscount + "Line Discount Amount" . I then set the labels to show if TotalLineDiscount > 0, however it is not working correctly. It works in the following circumstances:

1- an invoice for one item that receives the discount
2- an invoice for one item that does NOT receive the discount
3- an invoice for both types of items where the first item on the invoice is one that receives a discount.

I cannot get it to work when there are multiple items and the first one listed does not get a discount, but others do.

Can anyone offer any suggestions? I thought by creating the total discount variable, it would look at the total and decide if the label should be printed. I am thinking that maybe I need to move the code somewhere but nothing has worked correctly so far.

thanks for your help

Ron Gallagher

Comments

  • RobertMoRobertMo Member Posts: 484
    have you tried to do with 2 sections. one for showing the line with discounts and the other without...
    for first section you write in OnPreSection trigger:
    CurrReport.SHOWOUTPUT(LineDiscount<>0);

    on second section:
    CurrReport.SHOWOUTPUT(LineDiscount=0);
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • RGRG Member Posts: 9
    I tried the two sections, but it still isn't working correctly. It appears to be reading the TotalLineDiscount after only the first item when determining which heading to use. Again, my only problem is when the first item does not get a discount and subsequent items do. Any ideas as to where I could move the TotalLineDiscount := TotalLineDiscount + "Line Discount Amount" statement to in an effort to correct this problem?
  • RobertMoRobertMo Member Posts: 484
    I havn't noticed you were talking about showing labels not body.

    make a new var for Lines and a boolean HaveDiscounts
    OnPreDataItem you can go through you lines record and find out if you have discounts and properly set your boolean var.
    then you use previus hint of 2 sections...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.