Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84248members
353348posts

SQL Query with Tag Reference in Embedded List

EcoStruxure Geo SCADA Expert Forum

Find out how SCADA systems and networks, like EcoStruxure Geo SCADA Expert, help industrial organizations maintaining efficiency, processing data for smarter decision making with IoT, RTU and PLC devices.

Solved
justinoj
Ensign
Ensign
0 Likes
2
313

SQL Query with Tag Reference in Embedded List

Hi Experts, 

I'm looking for adding direct tag reference inside SQL query used in Embedded Lists. The aim is to place the embedded list inside template and instances can have queries 'relative to its area'. 

 

In the below embedded query WHERE condition, can I have a tag/variable reference which is relative? Something like CONCAT(%M(..FullName), '.%') which doesn't work.


SELECT TOP(100)
"RecordId", "SeverityDesc" AS "~SeverityDesc", "RecordTime" AS "~RecordTime", "Source", "Message", "User", "Category", "Foreground", "SeqNo", "CommentNo"
FROM
CDBEVENTJOURNAL
WHERE
"Source" LIKE CONCAT(%M(..FullName), '.%')

 

Thanks in advance,

Justin


Accepted Solutions
AdamWoodland
Commander Commander
Commander

Re: SQL Query with Tag Reference in Embedded List

You'll need to do this in the animations not the Query tab, set the sql animation to:

 

'SELECT TOP(100) "RecordId", "SeverityDesc" AS "~SeverityDesc", "RecordTime" AS "~RecordTime", "Source", "Message", "User", "Category", "Foreground", "SeqNo", "CommentNo" FROM CDBEVENTJOURNAL WHERE "Source" LIKE ''' + "..FullName" + '.%'''

 

The ''' are three single quotes, two of which will be interpreted as a single quote as part of the SQL syntax, and the last quote will be ending the literal string

See Answer In Context

2 Replies 2
AdamWoodland
Commander Commander
Commander

Re: SQL Query with Tag Reference in Embedded List

You'll need to do this in the animations not the Query tab, set the sql animation to:

 

'SELECT TOP(100) "RecordId", "SeverityDesc" AS "~SeverityDesc", "RecordTime" AS "~RecordTime", "Source", "Message", "User", "Category", "Foreground", "SeqNo", "CommentNo" FROM CDBEVENTJOURNAL WHERE "Source" LIKE ''' + "..FullName" + '.%'''

 

The ''' are three single quotes, two of which will be interpreted as a single quote as part of the SQL syntax, and the last quote will be ending the literal string

justinoj
Ensign
Ensign
0 Likes
0
303

Re: SQL Query with Tag Reference in Embedded List

Thanks Adam, that solved the problem.