Book a Demo

Author Topic: Help wanted bij custom query document generation  (Read 3749 times)

miba1980

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Help wanted bij custom query document generation
« on: December 20, 2016, 09:15:46 pm »
Hello,

I'm in need of some assistance regarding a custom query for my document templates.

Context:
I have a model with use cases, requirements, user interface and a domain model. In the use case scenario's I use some of the classes from my domain model. I am currently working on a document template that shows the use case scenario's, related activity diagrams, related user interface (mockup), related requirements and the related classes from my domain model.

All is working fine except the related classes. I've created a custom query for the classes fragment:
SELECT DISTINCT t_object.Name as objectname, t_attributeconstraints.Constraint as consname, t_attribute.Name as attrname, t_attribute.Type as attrtype
FROM t_attributeconstraints RIGHT JOIN ((t_object INNER JOIN t_connector ON t_object.Object_ID = t_connector.End_Object_ID) INNER JOIN t_attribute ON t_object.Object_ID = t_attribute.Object_ID) ON t_attributeconstraints.ID = t_attribute.ID
WHERE (((t_connector.Start_Object_ID)=#OBJECTID#))
and t_object.object_type = 'Class'

When I generate the use case document this query gives me:

Class: Address
AttributeTypeConstraint
PostalcodeString6This is a constraint

Class: Address
AttributeTypeConstraint
LandString

Class: Address
AttributeTypeConstraint
CityString40This is a constraint 1

Class: Address
AttributeTypeConstraint
CityString40This is a constraint 2

Class: Person
AttributeTypeConstraint
NameString40

But wat I wanted was:

Class: Address
AttributeTypeConstraint
PostalcodeString6This is a constraint
LandString
CityString40This is a constraint 1
This is a constraint 2

Class: Person
AttributeTypeConstraint
NameString40

Does anyone have any suggestions on how I can generate the classes, attributes and constraints in such a way?
« Last Edit: December 21, 2016, 06:57:46 am by miba1980 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Help wanted bij custom query document generation
« Reply #1 on: December 20, 2016, 09:53:27 pm »
I'm sorry I don't understand your question.
What are you trying to achieve, and what is going wrong?

Geert

miba1980

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Help wanted bij custom query document generation
« Reply #2 on: December 20, 2016, 10:01:45 pm »
Hi Geert,

I am trying to show the related classes (related to the use case), their attributes, types and constraints. The query I've made does that, but I want to generate them into my use case document.
But my problem is that I'm not able to show this information in the format I want. As you see in my post, I get a table per attribute per constraint. But I want 1 table per class (I want to show the name of the class as a header), with the attributes of that class and one or more constraints for that attribute.

Catch my drift? Or else I will switch to Dutch ;-)

Thanks in advance!
« Last Edit: December 20, 2016, 10:54:00 pm by miba1980 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Help wanted bij custom query document generation
« Reply #3 on: December 21, 2016, 03:30:16 pm »
Ah, I see.

Query fragments are best for tabular data, but you are expecting it to group on class. I don't think it can do that.
I think you'll have to get the class title in another template (regular) and use the sql fragment only for the purpose of getting the constraints of the class (but not the class name)
This type of problem can often be solved using virtual documents, where you define an SQL search to select the classes linked to element you are reporting on.

Geert

miba1980

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Help wanted bij custom query document generation
« Reply #4 on: December 22, 2016, 02:13:02 am »
Hi Geert,

Thanks! I will try to change my sql query and do a seperate one for the class name.

I didn't know that I could use virtual documents on a single element like a use case.... and generate the assoicated classes/objects. I always thought that virtual documents could only be on package level.

Thanks again