Topic
  • 10 replies
  • Latest Post - ‏2013-11-08T09:31:18Z by AbabiC.Andrei
AbabiC.Andrei
AbabiC.Andrei
7 Posts

Pinned topic ReporterPLUS - Filter report lines

‏2013-11-01T10:56:42Z |

Hi to everyone.

I am currently working on a template for a 3 column report that will be generated as a .csv file from ReporterPLUS. I've managed to make the iteration for all the columns as illustrated bellow:

Unit

File

Function/Method

Name of the software package

Name of the interface

Name of the operations that have the <<critical>> stereotipe

 

 

 

 

The model looks something like this:

<<Domain>> Vehicle (Package)

         |___<<Subdomain>> Drive (Package)

                 |___<<Subdomain>> OnBoardComputer (Package)

                              |___  Concept (Package)

                                          |___  Interfaces (Package)

                                                   |___ veh (Package)

                                                              |___ drive (Package)

                                                                        |___ IRandomInterface (Interface)

                                                                                    |___ <<critical>> get(arguments1) (operation)

                                                                                    |___ get(arguments2) (operation)

Looking at the example above my template should report the following:

Unit

File

Function/Method

OnBoardComputer 

IRandomInterface

get(arguments1)

Of course, there will be some interfaces that will not contain an operation with our stereotype therefore the 3rd column line will be empty.

My question is: How can i display only the lines that have that operation with the <<critical>> stereotype?

Any suggestion will be highly appreciated.

- Andrei 

 

Attachments

  • AThemis
    AThemis
    17 Posts
    ACCEPTED ANSWER

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-06T13:57:36Z  

    Hey,

    Thanks alot for your reply. The details you provided made me understand a little more on how this works but unfortunately i am still unable to find the right combination to make this filter what i want.

    I am a little confused on what OnAnyObject means in there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Signal".

    The element that should exist in my packages is an operation with the <signal> stereotype. So should this be there_exists $stereotype in [classes]->[operations] = "signal" or something like this? i tested this version but i receive a syntax error.

    Looking at this example...can you tell which structure of there_exists i should follow?

    <<Domain>> Vehicle (Package)

             |___<<Subdomain>> Drive (Package)

                     |___<<Subdomain>> OnBoardComputer (Package)

                                  |___  Concept (Package)

                                              |___  Interfaces (Package)

                                                       |___ veh (Package)

                                                                  |___ drive (Package)

                                                                            |___ IRandomInterface (Interface)

                                                                                        |___ <<critical>> get(arguments1) (operation)

                                                                                        |___ get(arguments2) (operation)

     

    Later EDIT: I forgot to say that $name of [nestedPackages]->[classes]->[operation]->[stereotype] = "signal" works in Q Tester only at the "veh" package level. So that is why i think that there_exists would be more appropiate for this. If we could itereate over all nested packages recursively and search for classes that meet this condition $name of [classes]->[operation]->[stereotype] = "signal" then I think that this will work. I tried a few solutions but they didn't work out. Any suggestion will be appreciated.

    Hi Andrei,

    so let me give example of my test:

     

    there_exists OnAnyObject in [classes]->[operation]->[stereotype]=>$name = "signal"

    See there_exists.bmp

    I test the expression on my Interfaces package in the model view in Rep+

    In the Q Expresion Tester window it shows 'true'

    The Q expression puts all the values of the stereotypes found in the operation within classes into a collection and then OnAnyObject will iterate over this collection and check to see if any equate to 'signal'

    Now, to use the expression I place it on my parent package

    See AdvancedQ.bmp

    To use this on packages further up I might put [nestedPackages] in the path, but I recommend you try the above first, get it working and then expand.

     

    there_exists OnAnyObject in [nestedPackages]->[classes]->[operation]->[stereotype]=>$name = "signal"

     

    regards,

    Andreas

     

     

     

     

     

  • MAXXU
    MAXXU
    8 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T01:09:45Z  

    Hello Andrei

     

    In ReportPLUS, conditions can be set on iterate of node, I think you can resolve your question by this function.

    Because 'the lines that have that operation with the <<critical>> stereotype' is a composite condition, It seems that a simple condition cannot realize it and please try the advanced condition via Q language .

     

    In fact, I haven't tried such a thing that I'm sorry to can't provide further helps like a sample except this advise,

    Please refer the Page 61 & 104 in below PDF file for more details.

    http://publib.boulder.ibm.com/infocenter/rsdp/v1r0m0/topic/com.ibm.help.download.rhapsody.doc/pdf/reporterplus.pdf

     

    Finally, please let me know how to do when you resolve it.

    Good luck.

     

    regards, Max

  • JeanZ
    JeanZ
    312 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T05:31:45Z  

    Hi

    I see you put the condition for stereotype on operation in the template which I think it's correct.

    By the way, if you removing the condition for stereotype, do you see all the operations are output in the table of the report?

    If not, probably the problem is existed in other place of the template.

     

    You can also try the existed templates in Rhapsody. I tried ClassOverviewPresentation.tpl and added the condition, it works well to filter the required info into the report.

    Hope above helps.

    Regards.

    Attachments

  • AbabiC.Andrei
    AbabiC.Andrei
    7 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T10:52:13Z  

    @MAXXU: Unfortunately I don't have alot of experience with Q language so i would need a hint on how this can be done :).

    @JeanZ: The condition for extracting the operation with certain stereotypes is correct. If I remove it then it will report all the operations indeed. What i am trying to achieve is to filter and dispay only the lines that have extracted an operation.

    So with our current template the table would be like this:

    Unit

    File

    Function/Method

    OnBoardComputer 

    IRandomInterface

    get(arguments1)

    Unit2 File2  
    Unit3 File3 get(arguments2)
    Unit4 File4  

    I would like to add a condition to display only this:

    Unit

    File

    Function/Method

    OnBoardComputer 

    IRandomInterface

    get(arguments1)

    Unit3 File3 get(arguments2)

     

  • AThemis
    AThemis
    17 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T14:41:50Z  

    @MAXXU: Unfortunately I don't have alot of experience with Q language so i would need a hint on how this can be done :).

    @JeanZ: The condition for extracting the operation with certain stereotypes is correct. If I remove it then it will report all the operations indeed. What i am trying to achieve is to filter and dispay only the lines that have extracted an operation.

    So with our current template the table would be like this:

    Unit

    File

    Function/Method

    OnBoardComputer 

    IRandomInterface

    get(arguments1)

    Unit2 File2  
    Unit3 File3 get(arguments2)
    Unit4 File4  

    I would like to add a condition to display only this:

    Unit

    File

    Function/Method

    OnBoardComputer 

    IRandomInterface

    get(arguments1)

    Unit3 File3 get(arguments2)

     

    Hi,

     

    I think you will have to set the condition to check for the stereotype in each cell.So the name and file will not show.

     

    Regards,

    Andreas

  • AbabiC.Andrei
    AbabiC.Andrei
    7 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T15:28:16Z  
    • AThemis
    • ‏2013-11-04T14:41:50Z

    Hi,

     

    I think you will have to set the condition to check for the stereotype in each cell.So the name and file will not show.

     

    Regards,

    Andreas

    Hello AThemis,

    Could you please provide an example? I tried something similar to what you said but it didn't work. I'm not sure how to add a condition to a top package based on an element that is at a lower level.

    Thank you!

  • AThemis
    AThemis
    17 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-04T17:22:40Z  

    Hello AThemis,

    Could you please provide an example? I tried something similar to what you said but it didn't work. I'm not sure how to add a condition to a top package based on an element that is at a lower level.

    Thank you!

    Hi there,

     

    so all you need is to traverse the current owner (Package that you are in, I see Unit and File text items in your first nestaedPackages iteration) and check that for this package, there exists a class with operations of a specific stereotype you need.  If there does not exist a class with a specific operation stereotype then don't do anything and move on to the next package in the model.

    To check a class exists in the package that has a specific stereotyped element, you will need to tell ReporterPLUS to look down the path.

     

    i find it simply to just load the model into ReporterPLUS, and drag and drop the element I want to look at (one that is loaded in Rep+), to the template window (see image)

    If you then select the node and go to the Condition tab you can see the full path.

    $name of [classes]->[stereotype] = "Signal"

    Maybe even $name of [nestedPackages]->[classes]->[stereotype] = "Signal"

    This would be the Q expression that you could put on the package to check in advance there is the required interface.

    You can even use the Q Tester and put this expression in and test on a package in the model view window (top left window of ReporterPLUS).

    However, if there are more than one stereotype then it might fail, as it sees it as a long strong rather than collection.

    You may need a more elaborate expression containing the there_is or there_exists Q expression in combination with the path above.  But I would need concrete example to construct that for you. 

    there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Singleton"

     

    (OnAnyObject is the object looked at in the collection)

     

    Hope this helps. 

     

    Andreas

     

    Attachments

  • AThemis
    AThemis
    17 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-05T11:06:03Z  

    Clarification:

     

    I mean

     

    there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Signal"

     

    will work, I tested it.

    Placed on a parent package, it will look in advance down the iteration, and check on all the classes and will return true if at least one stereotype is found on the class that matches.  I now realize you might be looking at operations on classes, so just added the additional [operations] into the path.

     

    Hope this helps,

     

    Andreas

  • AbabiC.Andrei
    AbabiC.Andrei
    7 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-05T13:57:49Z  
    • AThemis
    • ‏2013-11-05T11:06:03Z

    Clarification:

     

    I mean

     

    there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Signal"

     

    will work, I tested it.

    Placed on a parent package, it will look in advance down the iteration, and check on all the classes and will return true if at least one stereotype is found on the class that matches.  I now realize you might be looking at operations on classes, so just added the additional [operations] into the path.

     

    Hope this helps,

     

    Andreas

    Hey,

    Thanks alot for your reply. The details you provided made me understand a little more on how this works but unfortunately i am still unable to find the right combination to make this filter what i want.

    I am a little confused on what OnAnyObject means in there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Signal".

    The element that should exist in my packages is an operation with the <signal> stereotype. So should this be there_exists $stereotype in [classes]->[operations] = "signal" or something like this? i tested this version but i receive a syntax error.

    Looking at this example...can you tell which structure of there_exists i should follow?

    <<Domain>> Vehicle (Package)

             |___<<Subdomain>> Drive (Package)

                     |___<<Subdomain>> OnBoardComputer (Package)

                                  |___  Concept (Package)

                                              |___  Interfaces (Package)

                                                       |___ veh (Package)

                                                                  |___ drive (Package)

                                                                            |___ IRandomInterface (Interface)

                                                                                        |___ <<critical>> get(arguments1) (operation)

                                                                                        |___ get(arguments2) (operation)

     

    Later EDIT: I forgot to say that $name of [nestedPackages]->[classes]->[operation]->[stereotype] = "signal" works in Q Tester only at the "veh" package level. So that is why i think that there_exists would be more appropiate for this. If we could itereate over all nested packages recursively and search for classes that meet this condition $name of [classes]->[operation]->[stereotype] = "signal" then I think that this will work. I tried a few solutions but they didn't work out. Any suggestion will be appreciated.

    Attachments

    Updated on 2013-11-05T14:46:28Z at 2013-11-05T14:46:28Z by AbabiC.Andrei
  • AThemis
    AThemis
    17 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-06T13:57:36Z  

    Hey,

    Thanks alot for your reply. The details you provided made me understand a little more on how this works but unfortunately i am still unable to find the right combination to make this filter what i want.

    I am a little confused on what OnAnyObject means in there_exists OnAnyObject in [classes]->[stereotype]=>$name = "Signal".

    The element that should exist in my packages is an operation with the <signal> stereotype. So should this be there_exists $stereotype in [classes]->[operations] = "signal" or something like this? i tested this version but i receive a syntax error.

    Looking at this example...can you tell which structure of there_exists i should follow?

    <<Domain>> Vehicle (Package)

             |___<<Subdomain>> Drive (Package)

                     |___<<Subdomain>> OnBoardComputer (Package)

                                  |___  Concept (Package)

                                              |___  Interfaces (Package)

                                                       |___ veh (Package)

                                                                  |___ drive (Package)

                                                                            |___ IRandomInterface (Interface)

                                                                                        |___ <<critical>> get(arguments1) (operation)

                                                                                        |___ get(arguments2) (operation)

     

    Later EDIT: I forgot to say that $name of [nestedPackages]->[classes]->[operation]->[stereotype] = "signal" works in Q Tester only at the "veh" package level. So that is why i think that there_exists would be more appropiate for this. If we could itereate over all nested packages recursively and search for classes that meet this condition $name of [classes]->[operation]->[stereotype] = "signal" then I think that this will work. I tried a few solutions but they didn't work out. Any suggestion will be appreciated.

    Hi Andrei,

    so let me give example of my test:

     

    there_exists OnAnyObject in [classes]->[operation]->[stereotype]=>$name = "signal"

    See there_exists.bmp

    I test the expression on my Interfaces package in the model view in Rep+

    In the Q Expresion Tester window it shows 'true'

    The Q expression puts all the values of the stereotypes found in the operation within classes into a collection and then OnAnyObject will iterate over this collection and check to see if any equate to 'signal'

    Now, to use the expression I place it on my parent package

    See AdvancedQ.bmp

    To use this on packages further up I might put [nestedPackages] in the path, but I recommend you try the above first, get it working and then expand.

     

    there_exists OnAnyObject in [nestedPackages]->[classes]->[operation]->[stereotype]=>$name = "signal"

     

    regards,

    Andreas

     

     

     

     

     

  • AbabiC.Andrei
    AbabiC.Andrei
    7 Posts

    Re: ReporterPLUS - Filter report lines

    ‏2013-11-08T09:31:18Z  
    • AThemis
    • ‏2013-11-06T13:57:36Z

    Hi Andrei,

    so let me give example of my test:

     

    there_exists OnAnyObject in [classes]->[operation]->[stereotype]=>$name = "signal"

    See there_exists.bmp

    I test the expression on my Interfaces package in the model view in Rep+

    In the Q Expresion Tester window it shows 'true'

    The Q expression puts all the values of the stereotypes found in the operation within classes into a collection and then OnAnyObject will iterate over this collection and check to see if any equate to 'signal'

    Now, to use the expression I place it on my parent package

    See AdvancedQ.bmp

    To use this on packages further up I might put [nestedPackages] in the path, but I recommend you try the above first, get it working and then expand.

     

    there_exists OnAnyObject in [nestedPackages]->[classes]->[operation]->[stereotype]=>$name = "signal"

     

    regards,

    Andreas

     

     

     

     

     

    Hello Andreas,

    Thank you very much for your help. I managed to create a filter in order to extract only the elements that i wanted using your advice. The issue is that i was insisting on applying a single filter for all the nodes but instead I made a different filter for each one of them and it properly works. 

    Have a great day!

    - Andrei