Author Topic: Custom SQL Query passing EAGUID or Scenario?  (Read 2441 times)

meeert

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Custom SQL Query passing EAGUID or Scenario?
« on: December 21, 2023, 09:08:37 pm »
Hi,

I'm trying to access the EAGUID to filter per scenario in a way like the #OBJECTID# is being passed in SQL within Templates.

Code: [Select]
SELECT
a.step.value('@level', 'NVARCHAR(MAX)') AS 'step',
a.step.value('@name', 'NVARCHAR(MAX)') AS 'action',
a.step.value('@result', 'NVARCHAR(MAX)') as result,
a.step.value('@uses', 'NVARCHAR(MAX)') as comment
FROM
(SELECT CAST(XMLContent AS XML) AS Content FROM t_objectscenarios WHERE Object_ID = #OBJECTID# ???AND ea_guid = #EAGUID#???) s
CROSS APPLY Content.nodes('/path/step') a (step)

Is there a way to pass the EAGUID within a custom query (template)? OR Scenario name with SQL? Or should I use a custom script to get the desired result?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13295
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Custom SQL Query passing EAGUID or Scenario?
« Reply #1 on: December 21, 2023, 09:38:21 pm »
No, fragments are executed per object, not per scenario.

Geert

meeert

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Custom SQL Query passing EAGUID or Scenario?
« Reply #2 on: December 21, 2023, 09:40:49 pm »
Not even when the 'Scenario' checkbox is enabled within the template?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13295
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Custom SQL Query passing EAGUID or Scenario?
« Reply #3 on: December 21, 2023, 09:53:30 pm »
Not even when the 'Scenario' checkbox is enabled within the template?
No, doesn't matter. The only parameter your fragment is getting is the object ID

Geert