Extracting Scaffolding Data from children pages and modifying values using Reporting macro

Scenario

This recipe is relevant for page structures containing a parent page and children pages like below:

In the child pages, a simple form is created by adding Scaffolding macros directly inside a HTML table (no Scaffolding's Table Data macro is used).

This recipe shows how to extract text fields from the Text Data macro, modify the value and display it in a report on a different page.

In this example we are capturing a field named "Website" in the children pages (eg. www.google.com/about).

The macro will modify the website value so that only the main website URL (eg. www.google.com) is displayed in the Reporting (Parent) page.


Result


Recipe

Ingredients

Storage format

Macro structure

You can recreate the example in the editor view:

Steps

  1. Add a Report Table macro and within add a Local Reporter macro. Set the Local Reporter macro's Key parameter to page:children.
  2. Inside the Local Reporter macro, add a Text Sort macro and set the Key to page:title.
  3. Below the Local Reporter macro, add a Report Column macro and set the macro's Title to "Page Title".
  4. Add a Report Info macro within the Report Column macro and set the macro's Key to page:title and Link to item to True.
  5. Add another Report Column macro and set the macro's Title to "Project Name".
  6. Add a Report Info macro within the Report Column macro and set the macro's Key to data:proj_name.
  7. Add another Report Column macro and set the macro's Title to "Location".
  8. Add a Report Info macro within the Report Column macro and set the macro's Key to data:proj_location.
  9. Add another Report Column macro and set the macro's Title to "Priority".
  10. Add a Report Info macro within the Report Column macro and set the macro's Key to data:proj_priority.
  11. Add another Report Column macro and set the macro's Title to "Website" and set Injected to True.
  12. Inside the Report Column macro, add a Report Block macro.
  13. Inside the Report Block macro, add a Local Reporter macro. Set the Local Reporter macro's Key parameter to @self.
  14. Inside the Local Reporter macro, add a Text Filter macro and specify the following:
    1. Key: data:proj_website
    2. Include: .*//.* (This will look for every website value that contains // in their URL)
  15. Below the Local Reporter macro, add a Report Body macro.
  16. Inside the Report Body macro, add a Report Link macro and specify the following:
    1. Key: data:proj_website
    2. Trim URL Whitespace: True
    3. Title: %page:title% - Website
    4. Target Frame: _blank
  17. Right inside the Report Link macro, enter the following value:
    %data:proj_website > text:split with // > collection:last > text:split with / > collection:first%
  18. Below the Report Body macro, add a Report Empty macro.
  19. Inside the Report Empty macro, add a Report Link macro and specify the following:
    1. Key: data:proj_website
    2. Trim URL Whitespace: True
    3. Title: %page:title% - Website
    4. Target Frame: _blank
  20. Right inside the Report Link macro, enter the following value:
    %data:proj_website > text:split with / > collection:first%


On the Website column, create the following conditions:

  1. Condition 1
    1. If the URL starts with https, then remove all the characters before //
    2. Then, search for the character /
    3. Once the supplier finds the character /, remove all the characters after that.
      For example, the URL https://google.com/about will become google.com

  2. Condition 2
    1. If the URL does not have https, then look for the character / which then removes all the characters after that.
      For example, the URL www.google.com/about will become www.google.com