Excerpt |
---|
Enables you to display data that is generated by SIL script in a table, great for reporting. |
...
- To create a script, go to Confluence Administration > Add-ons > cPrime Tools, and click SIL Manager.
- Click the silprograms folder and then New > New file.
- Create a new SIL file and name it, for example, CollectDescendants.sil like in the image below.
In the CollectDescendants.sil file that you created write the following script. It represents how the TableScriptMacro uses the standard variables.
Then click Check and Save.Code Block include "PageDTO.incl"; PageDTO[] dtos; if (size(argv) < 2) { print("space key and page title are not specified"); return dtos; } string spaceKey = argv[0]; string pageTitle = argv[1]; number page = getPage(spaceKey, pageTitle); if (page < 0) { print("space'" + spaceKey + "' has no page '" + pageTitle + "'"); } number[] descendants = getPages(page); for (number pageId in descendants) { PageDTO dto; dto.id = %pageId%.id; dto.author = %pageId%.author; dto.title = %pageId%.title; dto.created = %pageId%.created; dto.updated = %pageId%.updated; dtos += dto; } return dtos;
- Supporting script Page DTO is created. This script contains information about the following columns: ID, Author, (page) Title, Created, and Updated.
- You can find more information about managing your SIL Scripts on the SIL Manager page.
2. Creating a TableScriptMacro
...
You have created CollectDescendants.sil script and a TableScriptMacro that is associated with this script.
Result
Every time you that update a page, the macro will display data generated by the selected SIL script in a table.
...