Book a Demo

Author Topic: RTF Woes  (Read 4293 times)

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
RTF Woes
« on: May 11, 2010, 08:54:01 pm »
Hi
I have created a custom search which executes perfectly.
When I try to use it from within a model document I get a dialog stating
'The specified field Object_ID could refer to more than one table listed in the FROM clause of your SQL statement.

Here is my query
Code: [Select]
SELECT ea_guid AS CLASSGUID, Object_Type AS CLASSTYPE, t_objectproblems.Problem, t_object.Name
FROM t_objectproblems INNER JOIN t_object ON t_object.Object_ID = t_objectproblems.Object_ID WHERE t_objectproblems.ProblemType = 'Issue'  

Any help appreciated

Graham
Using V12

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF Woes
« Reply #1 on: May 11, 2010, 09:16:35 pm »
try this:
Code: [Select]
SELECT o.ea_guid AS CLASSGUID, o.Object_Type  AS CLASSTYPE, op.Problem, o.Name
FROM t_objectproblems op INNER JOIN t_object o ON o.Object_ID = op.Object_ID
WHERE op.ProblemType = 'Issue'

Geert

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: RTF Woes
« Reply #2 on: May 11, 2010, 11:04:38 pm »
Hi Geert

Thanks for that - it works!!
BUT I dont know why, please coild you expain what I did wrong and how you fixed it?

Thanks

Graham
Using V12

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF Woes
« Reply #3 on: May 11, 2010, 11:23:47 pm »
I used aliasses, and not tablenames to identify the different Object_ID columns.
Strictly speaking that should not be necesarry, but in any case it is a lot safer to always use an alias.

I think that for some (bizarre sparxian) reason the full tablenames got stripped from the join clause, which would result in the error you saw.

Geert

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: RTF Woes
« Reply #4 on: May 11, 2010, 11:26:43 pm »
Ah I see - thanks for taking the time

BTW - would there be a way to extract the package name associated with element

Graham
Using V12

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF Woes
« Reply #5 on: May 11, 2010, 11:29:01 pm »
Code: [Select]
SELECT o.ea_guid AS CLASSGUID, o.Object_Type  AS CLASSTYPE, op.Problem, o.Name as ElementName, p.Name as PackageName
FROM t_objectproblems op
INNER JOIN t_object o ON o.Object_ID = op.Object_ID
INNER JOIN t_package p on o.Package_ID = p.Package_ID
WHERE op.ProblemType = 'Issue'

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: RTF Woes
« Reply #6 on: May 11, 2010, 11:45:35 pm »
Hi Geert
Thanks for trying but I get
'Syntax Error(missing operator) in query expression'o.Object_ID = op.Object_ID INNER JOIN t_package p on o.Package_ID = p.Package_ID'

Graham
Using V12

beginner

  • Guest
Re: RTF Woes
« Reply #7 on: May 12, 2010, 12:57:28 am »
SQL is not necessarily SQL. It depends on the server.

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: RTF Woes
« Reply #8 on: May 12, 2010, 02:01:09 am »
That sql works on MS-SQL Server. For Access you have to enclose the joins in parentheses. (look on the community server for examples of EA search definitions)

Geert