Book a Demo

Author Topic: Filtering data in a report  (Read 2476 times)

EA-user

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Filtering data in a report
« on: May 15, 2023, 11:09:23 pm »
Hello all

I've been working with reports in Sparx for a long time, but I just can't understand the logic of the filters.

For example, I have a several Actors with  Tag = Role (Working, Non-working). These actors are associated with Blocks with Tag=Shape (triangle, rectangle).

My goal is to get the following table.

Column 1 - all actors with a role (Worker). Column 2 - all blocks associated with these actors that have the Shape Tag = Rectangle.

Actor1 (Worker)       | Rectangle 1
Actor2 (Worker)     | Rectangle 2

I can filter all the actors and report only them. An example template is below.

In the fragment, I select all the elements associated with the Actor.

In this case, I get the following table:

Actor1 (Worker)       | Rectangle 1
Actor2 (Worker)      | Triangle 1
                              | Rectangle 2

If I add a filter TagValue = Rectangle in the fragment, then the template will no longer find any matches.

If I remove the filter in the template for the actor (Role=Worker), then the template will filter by the filter specified in the fragment (Shape = Rectangle):

Actor1 (Worker)   
Actor2  (Worker)   
Actor3   
Actor4   
Rectangle 1   | Rectangle 1

Rectangle 2   | Rectangle 2
Rectangle 2

Triangle 1   
Triangle 2   

Can you please tell me how can I properly filter the elements at the template level, and then additionally filter the elements by fragment?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Filtering data in a report
« Reply #1 on: May 15, 2023, 11:14:44 pm »
Filters work on the main element only, not on a related element.

For fragments, I usually use SQL fragments as I can select whatever I need and define the criteria in the query.

Geert

EA-user

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Filtering data in a report
« Reply #2 on: May 16, 2023, 04:19:18 pm »
Thanks Geert!

I'll try to use this approach too.