Book a Demo

Author Topic: Using personal, fixed #Branch# Keyword for SQL Queries  (Read 18068 times)

amacara1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Using personal, fixed #Branch# Keyword for SQL Queries
« Reply #15 on: March 27, 2023, 10:37:06 pm »
Hi!

But what if GUID is a field already returned during SQL query - then, how could I use #Branch=#?

For example, this does not work (assuming Keywords field of 'SpecialName' element holds a GUID):
select Obj.Name from (t_object Obj inner join t_object MetaElem on MetaElem.Name = 'SpecialName')
where Obj.Package_ID in (#Branch=MetaElem.Keywords#)

If I write the GUID directly in #Branch=#, it works fine.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Using personal, fixed #Branch# Keyword for SQL Queries
« Reply #16 on: March 27, 2023, 10:57:37 pm »
The reason it doesn't work is because of the order of evaluation.

What happens if you let EA execute such an SQL query, is that it first evaluates all macros such as #Branch# and only after replacing the macro's it will execute the query.

MetaElem.Keywords is is not known before executing the query. It is taken as a literal text.

Geert

amacara1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Using personal, fixed #Branch# Keyword for SQL Queries
« Reply #17 on: March 28, 2023, 12:00:05 am »
That makes perfect sense! Thank you.