Accessing Port Properties

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Accessing Port Properties

Postby david.brodrick@anu.edu.au » Tue Dec 04, 2018 3:18 am

Hi,
I am working on a Report Template to generate an ICD.

I am planning on using a Blackbox ICD table as the basis for this. The table contains a list of ports. Each of the ports is typed by a block. The table rows show the Type Features from the corresponding blocks. The Feature Direction is N/A.

My objective it to have a section in the report for each of the ports, which includes a heading, the "Type" (of the block which types the port), documentation, multiplicity, etc., and each of the values and operations associated with the block/type of the port.

I have tried many different ways, but I cannot figure out how to access the following information from the port reference in the template: name of the typing block, list of all of the values and operations. The provided/required attributes which return an Interface[] are empty, I guess because the feature directions are N/A, even though the individual values on the typing block contains a direction.

Code: Select all
#foreach($diagram in $Diagram)
#if($diagram.diagramType == “Blackbox ICD Table”)
#foreach($e in $report.getDiagramElements($diagram))
#if ($e.elementType==”port”)
Interface Port
Type: $e.humanType ///This just says 'Port' but really I want the Type of the block which types the port
Multiplicity: $e.multiplicity
///This is where I would like to be able to put a foreach value and operation in the typing block, but I do not know how to access them
Documentation:
$e.documentation
#end
#end
#end
#end


Sincere thanks,
David
david.brodrick@anu.edu.au
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Tue Dec 04, 2018 2:55 am

Re: Accessing Port Properties

Postby sarawut_w » Wed Dec 05, 2018 8:45 pm

Dear David,

Thank you for your explanation.
For making us on the same page, and this is the fastest way to provide you a solution, please send us the sample project/model and your expected output report files.

Best regards,
Sarawut W.
Support Engineer
sarawut_w
No Magic
No Magic
 
Posts: 326
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am

Re: Accessing Port Properties

Postby david.brodrick@anu.edu.au » Thu Dec 06, 2018 5:33 pm

Thanks Sarawut.

I attach a trivial example of the kind of model I am working with, including a Blackbox ICD table.

What I want, is to be able to generate a report by selecting a Blackbox ICD table from our model, and to format it something like what I show below. This will be combined with other information from the model and variables, to form the final complete ICD.

I have been working with VTL similar to my OP above.

The desired output in the report would be akin to this:

Interface Port - I_WidgetInterface
Multiplicity: 1
Signals and Operations:
* measurement: Voltage
* triggerSomething()
Documentation:
This widget requires 2xAA batteries.


The things I cannot access at the moment are the type of the block which types the port (I_WidgetInterface) or the attributes and operations of that typing block (measurement and triggerSomething).

If you could please offer suggestions on how to access these additional pieces of information I would be sincerely appreciative.

Regards.
You do not have the required permissions to view the files attached to this post.
david.brodrick@anu.edu.au
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Tue Dec 04, 2018 2:55 am

Re: Accessing Port Properties

Postby sarawut_w » Thu Dec 06, 2018 8:49 pm

Hello,

Thank you for your model.
For now, you could get only String value from the Table diagram.
So, you could not get Port P1 and retrieve its properties.
From the first column, you could get only P1 name, not Port P1 object.
We recommend you to use that name for getting the real object through $report.findElementInCollection(elementList, name).
Please see the sample code:
Code: Select all
#import('generic', 'com.nomagic.reportwizard.tools.GenericTableTool')
#foreach($diagram in $Diagram)
#if($diagram.diagramType == “Blackbox ICD Table”)
#set($table = $generic.getTable($diagram))
#foreach($row in $table.getRows())
#set($port = $report.findElementInCollection($Port,$table.getValue($row, “QPROP:Element:name”)))
Port name = $port.name
Port multiplicity = $port.multiplicity
#set($type = $port.type)
Port type = $report.getIconFor($type) $type.name
#foreach($member in $type.member)
-   $report.getIconFor($member) $member.name
#end
Port documentation = $port.documentation
#end
#end
#end


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

Re: Accessing Port Properties

Postby david.brodrick@anu.edu.au » Mon Dec 10, 2018 5:58 pm

Hi Sarawut,
Thanks very much for the reply. That is a good solution.

Unfortunately it is not working for me. Perhaps the $Port collection is not populated in MD v18.5?

The following does not produce any output for me:

Code: Select all
#foreach ($p in $Port)
port = $p.humanName $p.humanType
#end


Do you have any other suggestions for how I can obtain a reference to the ports?

Many thanks.
david.brodrick@anu.edu.au
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Tue Dec 04, 2018 2:55 am

Re: Accessing Port Properties

Postby sarawut_w » Mon Dec 10, 2018 10:44 pm

Hello,

Please make sure your Port type is really "Port".
Check them by opening their Specification dialog, the type is before port's name.
type.png


If your port's type is not "Port", you could not list them by $Port variable.
For example, if they are Proxy Port, you could list them by $ProxyPort variable.

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: 326
Posts Rating:23
Joined: Thu Jun 23, 2011 12:47 am

Re: Accessing Port Properties

Postby david.brodrick@anu.edu.au » Thu Dec 13, 2018 12:12 am

Thanks - the problem was that, while the ICD table was in scope the actual Port definitions were not.

Thanks for your support.
david.brodrick@anu.edu.au
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Tue Dec 04, 2018 2:55 am


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests