Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Kaidou_91 on January 10, 2019, 08:18:59 pm
-
Hi,
how can I use a SQL query to select some information from the element that is being processed by the template?
For example, I'm using this SQL query:
" SELECT distinct t_operation.Type as ReturnType, t_operation.Name as OperationName, t_operation.Scope as OperationScope, t_operationparams.Type as ParamType, t_operationparams.Name as ParamName, t_operationparams.Kind as ParamDirection, t_operation.Object_ID as ObjID
FROM t_operation, t_operationparams
where t_operation.OperationID = t_operationparams.OperationID and t_operation.Object_ID = #CurrentElementID# "
with the macro "#CurrentElementID#" for selecting the information needed from the current element. Does it look right?
I tried the above query (replacing #CurrentElementID# with an actual ElementID) in the search panel and it works.
Could someone please explain me how it works?
Thanks
-
Please read https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/custom_sql_fragments.html (https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/custom_sql_fragments.html)
There is no such thing as #CurrentElementID#, but you can use #OBJECTID#
Geert
PS. I would use the join syntax to join tables.
-
I found "#CurrentElementID#" macro in here : https://www.sparxsystems.com/enterprise_architect_user_guide/14.0/model_navigation/creating_filters.html
But probably I didn't use it right ;D
Anyway #OBJECTID# worked.
Thanks!