Getting the second last entry from Table Data

Scenario

This recipe retrieves the second last row of a Table Data macro when the table is dynamic in size and uses Scaffolding Table Data and Text Data macros in the reporting process.



Result


Recipe

Ingredients

Apps

Reporting, Scaffolding 
Platform
Server, Data Center
Level

EASY

Estimated time

10 minutes

Macros

Suppliers

Storage format

Macro structure

You can recreate the example in the editor view:

Steps

  1. Let's start by creating a dynamic table which allows a user to enter data.
    Create a Table Data macro with the name "mytable".

  2. Inside that Table Data macro, create a table with one column and two rows. Like this:

    Cities

    In this example, we used "Cities" as a title for our column but feel free to change it to anything you prefer.

  3. Now create a Text Data macro under the "Cities" column.

  4. For the Text Data macro, set the Field Name parameter to "mytext", type to "line", and Content to "text".

  5. Outside the Table Data macro, create a Report Block macro and tick the Injected parameter.

  6. Within the Report Block macro, create Report Variable macro with the following parameters:
    Name: "rev"
    Value%data:mytable > reverse% 

  7. Within the Report Block macro, create Local Reporter macro and set the Key to "@self".

  8. Still within the Report Block macro, create a Report Body macro, and type "Getting the second last entry from Table Data macro:".

  9. Still within the Report Body macro, create a Report Info macro and set the Key to "variable:rev > 2 >mytext".