Add a repeater on your report

Add a repeater on your report

In some cases, it is necessary to add a repeater to your Business Central reports. For instance, if you want to print one label for each item of quantity on your Sales Order. We have created the Repeater Line temporary table for this reason.

 

Usage scenario 1 – repeat per item

Using an item type repeater gives you one line per item quantity. For example, if you have a quantity of 5, you will get 5 lines. Any remaining quantity is shown on the last line. If there is a quantity of 5.1 you get 6 lines, and the quantity on the last line is 0.1.

To add an item type repeater line:

  1. Add a Data Item and set the Data Item
    Table to ForNAV Repeater Line.
  2. Set Temporary and Auto Populate to True.
  3. Set the Data Item Link to “Total Quantity”=FIELD(Quantity).
  4. Set the Data Item Table View to WHERE(“Line Per”=CONST(0)).

This repeater type will display Item Tracking information if it is available.

 

Usage scenario 2 – repeat per line

Using a line type repeater gives you one repeater record per source record, regardless of the quantity.

To add a line type repeater line:

  1. Add a Data Item and set the Data Item Table to ForNAV Repeater Line.
  2. Set Temporary and Auto Populate to True.
  3. Set the Data Item Link to “Total Quantity”=FIELD(Quantity).
  4. Set the Data Item Table View to WHERE(“Line Per”=CONST(1)).

 

Usage scenario 3 – repeat per unit of measure

Using a unit of measure repeater type gives you one line per item unit of measure. For example, if you have a quantity of 4 and a unit of measure quantity of 2 (2 items per box), you get 2 lines. Any remaining quantity is shown on the last line. If there is a quantity of 5.1, you get 3 lines and the quantity on the last line is 1.1.

To add a unit of measure type repeater line:

  1. Add a Data Item and set the Data Item Table to ForNAV Repeater Line.
  2. Set Temporary and Auto Populate to True.
  3. Set the Data Item Link to “Total Quantity”=FIELD(Quantity), “Quantity Per”=FIELD(“Qty. per Unit of Measure”).
  4. Set the Data Item Table View to WHERE(“Line Per”=CONST(2)).

 

Usage scenario 4 – repeat per tracking entry

Using an item tracking entry repeater type gives you one line per item tracking entry. It only shows lines for the actual item tracking entries. If you have a quantity of 5 and a total quantity of 3 on item tracking entries, you get records for those 3.

To add an item tracking entry type repeater line:

  1. Add a Data Item and set the Data Item Table to ForNAV Repeater Line.
  2. Set Temporary and Auto Populate to True
  3. Set the Data Item Link to “Total Quantity”=FIELD(Quantity).
  4. Set the Data Item Table View to WHERE(“Line Per”=CONST(3)).

 

Using the repeater line in your extensions

Of course, you might also want to use the repeater line in your own extensions. You can use the API in the ForNAV Repeater Line table for this. Simply set the required quantities in the first repeater line record and let ForNAV take care of the rest.

For an example on how to use the repeater table, please look at report 6188512 “ForNAV Sales Shpt. Label”.

local procedure SetNoOfLabels()
    begin
        Label."Total Quantity" := Line.Quantity;
        case Args."Label per" of
            Args."Label per"::"Unit of Measure":
                Label."Quantity Per" := Line."Qty. per Unit of Measure";
        end;

        Label."Line Per" := Args."Label per";
        Label.Fill(Line);
    end;