Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Fuglesteg on January 26, 2017, 08:21:22 pm

Title: Find substring in element notes using SQL query
Post by: Fuglesteg on January 26, 2017, 08:21:22 pm
Hello,

I am trying to create a model view listing all requirements in my model that has the word TBD in t_object.Note. TBD is part of a requirement statement. I have tried the following code with various wildcard combinations:

SELECT t_object.Alias As Alias, t_object.Name As Name, t_object.Note As notes
From t_object
Where t_object.Object_Type = 'Requirement' And t_object.Note LIKE '%TBD%'

This seems to work only when TBD are the only word in the notes. It does not return any results if TBD is part of a sentence.

Any help is appreciated.
Title: Re: Find substring in element notes using SQL query
Post by: Uffe on January 26, 2017, 08:34:09 pm
Hello,

The wildcard character differs between SQL dialects, so it depends on which DBMS you're using.
For Access databases (.EAP file), the query works with '*'.

/Uffe
Title: Re: Find substring in element notes using SQL query
Post by: Fuglesteg on January 27, 2017, 01:44:00 am
Thank you uffe,
Problem solved
Title: Re: Find substring in element notes using SQL query
Post by: Geert Bellekens on January 27, 2017, 06:20:24 pm
In the future best use the macro #WC# as this works on any type of repository.

Geert
Title: Re: Find substring in element notes using SQL query
Post by: Uffe on January 27, 2017, 07:43:34 pm
In the future best use the macro #WC# as this works on any type of repository.

Does that work in free-form SQL queries entered manually?
Title: Re: Find substring in element notes using SQL query
Post by: Geert Bellekens on January 27, 2017, 09:05:35 pm
In the future best use the macro #WC# as this works on any type of repository.

Does that work in free-form SQL queries entered manually?
No, only in actual SQL Search queries, not in the scratch pad (and probably not when using the API)

Geert