Automatic update of custom report

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Automatic update of custom report

Postby nathan_h » Tue Sep 11, 2018 11:11 am

Hi,

I want to create a template that automatically reflects changes from cameo when a document is generated. More specifically, I would have a section called section 3, then a subsection 3.1, 3.1.1, 3.2, 3.2.1, etc., and in future if someone creates a new subsection in cameo, say section 3.2.2 or 3.3 I would like that to automatically update when the document is generated so no change has to be made to the velocity template. Also figures may or may not exist between subsections. I am currently able to create a template that can generate a section 3, 3.1, etc.(using $report.filter), but if an addition of a new subsection were to be made in cameo then there would also need to be a corresponding change made in the velocity template, so I want to avoid that step.

Any help would be great
Thank you
nathan_h
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Tue Sep 11, 2018 10:56 am

Re: Automatic update of custom report

Postby sarawut_w » Tue Sep 11, 2018 9:14 pm

Hello,

Could you provide us the sample model and template?
In the sample model, please point out how to define level of section and subsection.

Best regards,
Sarawut
sarawut_w
No Magic
No Magic
 
Posts: 336
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am

Re: Automatic update of custom report

Postby nathan_h » Wed Sep 12, 2018 3:57 pm

Attached is a dummy model of "section 3" along with the template file.
In the model all the sections are on the same level, however, in the document file the sections are leveled using "heading 2" and "heading 3".

Thanks
You do not have the required permissions to view the files attached to this post.
nathan_h
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Tue Sep 11, 2018 10:56 am

Re: Automatic update of custom report

Postby sarawut_w » Wed Sep 12, 2018 8:38 pm

Hello,

Please see the code in the attachment:
template.docx


In the attachment, we provide you the template that getting all Requirement Section by checking ID property that starts with "S ".
Then, we check for the level of section by splitting the ID.
We call for macro for printing section. In the macro, we print the section by checking level and apply proper text Style, and print some of text, including figure for some Requirements.

Because, we do not have your Style, you would rather to copy the code and handle text Style by yourself.
- Apply the proper text style to each level of the Requirement section.
- Apply Figure style to the figure Requirement.
- Add,delete and handle the content in the #if#else condition, for each level of Requirement section.

Best regards,
Sarawut
You do not have the required permissions to view the files attached to this post.
sarawut_w
No Magic
No Magic
 
Posts: 336
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am

Re: Automatic update of custom report

Postby nathan_h » Thu Sep 13, 2018 2:09 pm

Thank you for the help I am able to have it automatically update, however I am having an issue with the ordering when it gets placed into the sample document. It is ordering the requirements alphabetically by name(I was able to verify this by using different names), so when I generate my document it looks something like this

[id] [Name]
3.1 Sample 0
3.1.1 Sample 1
3.1.3 Sample 10
...
3.1.1.1 Sample 2
3.1.1.2 Sample 3

Since the first word of the name is the same for each requirement it proceeds further into the name and orders it by the number in the name. So if I made a "3.1.1.3 Sample 11" that would be placed right after "3.1.3 Sample 10" rather than after "3.1.1.2 Sample 3". I would like for the requirements to be in order by level of their ids instead. Is there a fix for this?

Thank you
nathan_h
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Tue Sep 11, 2018 10:56 am

Re: Automatic update of custom report

Postby sarawut_w » Thu Sep 13, 2018 9:08 pm

Hello,

You would rather need to update the code only this line:
Code: Select all
#foreach($r in $sorter.humanSort($query.get("requirement[id^=S ]")))

You need $sorter.humanSort(), this would sort your Requirement name by considering the number in name as integer.

Best regards,
Sarawut
sarawut_w
No Magic
No Magic
 
Posts: 336
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests