Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

Structured Text SQL Query with Direct Variable filter

EcoStruxure Geo SCADA Expert Forum

Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • Remote Operations
  • EcoStruxure Geo SCADA Expert Forum
  • Structured Text SQL Query with Direct Variable filter
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
sbeadle
Kirk sbeadle Kirk
308
AndrewScott
Admiral AndrewScott
96
BevanWeiss
Spock BevanWeiss
91
AdamWoodlandToo
Lt. Commander AdamWoodlandToo
37
View All
Related Products
product field
Schneider Electric
EcoStruxure™ Geo SCADA Expert

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to EcoStruxure Geo SCADA Expert Forum
Solved
Hardin4019
Lieutenant Hardin4019
Lieutenant

Posted: ‎2020-10-09 12:49 PM . Last Modified: ‎2023-05-03 12:09 AM

0 Likes
3
3215
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-10-09 12:49 PM . Last Modified: ‎2023-05-03 12:09 AM

Structured Text SQL Query with Direct Variable filter

I'm trying to make life a little easier on myself. I have a Mimic with some fields to enter information about a meter template. In particular this meter template doesn't have its own Outstation/Scanner, (this template is for a second, third, or forth meter run). I want to fill in a field "ScannerParentGroupName" that is a String type Variable that I want to use to filter a query in my structured text program that I will setup to fill in the ScannerID field for the points in the template. I have structured text program below, but for some reason, the program upon execution will ask you what value should be assigned to "Scan" since it is a VAR_INPUT. Moving the Scan := ScannerParentGroupName; up before the query doesn't work, and changing the VAR_INPUT to VAR doesn't work. What am I missing?

 

Code;

 

TYPE

SCANNER : DATABASE_OBJECT(TfScanner)
ID: STRING;
FULLNAME: STRING;
END_DATABASE_OBJECT;

END_TYPE

 

PROGRAM TEST

VAR_INPUT
Scan:STRING;
END_VAR

VAR
NEWSTRING AT %M(.New String):STRING;
ScannerParentGroupName AT %I(.Scanner Parent Group Name):STRING;
END_VAR

VAR NOCACHE
Os AT %S(SELECT Id, ID AS SCANNNERID, FULLNAME FROM TfScanner WHERE FULLNAME LIKE ?) : RESULTSET OF SCANNER WITH_PARAMS Scan;
END_VAR
Scan := ScannerParentGroupName;
NEWSTRING := Os.Value.ID;

END_PROGRAM

Labels
  • Labels:
  • Logic
  • SCADA
  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA control
  • SCADA data
  • SCADA integration
  • SCADA network
  • SCADA programming
  • SCADA software
  • scada system
  • SCADA tutorial
  • SCADA web application
  • Telemetry and SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
geoffpatton
Captain geoffpatton
Captain

Posted: ‎2020-10-09 01:40 PM

0 Likes
0
3213
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-10-09 01:40 PM

I have a ST program that on interval executes just fine, but if I right click on it and select execute then it prompts me for the ParentFolderInput. It was written in version 2010 R1.1

 

I was annoyed by it and thought it should not do that, but at the time I was trying to get the project finished and since it worked on a Interval as I needed it I just moved on and never inquired why it does this.

 

If you use a method button to execute it, you can set it to a null '' (single quote, single quote) for its initial value.

 

Here is what  I did for reference.

PROGRAM MyTextProgram

METHOD
Exec AT %M(.Trigger ST_EA.Execute):STRING;
END_METHOD
VAR
ParentFolder AT %M(..FullName) : STRING;
END_VAR

VAR_INPUT
ParentFolderInput : STRING;
END_VAR

ParentFolderInput := CONCAT(ParentFolder, '.BI.%');

Exec(ParentFolderInput);

END_PROGRAM

See Answer In Context

  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA control
  • SCADA data
  • SCADA integration
  • SCADA network
  • SCADA programming
  • SCADA software
  • scada system
  • SCADA tutorial
  • SCADA web application
  • Telemetry and SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

Replies 3
geoffpatton
Captain geoffpatton
Captain

Posted: ‎2020-10-09 01:40 PM

0 Likes
0
3214
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-10-09 01:40 PM

I have a ST program that on interval executes just fine, but if I right click on it and select execute then it prompts me for the ParentFolderInput. It was written in version 2010 R1.1

 

I was annoyed by it and thought it should not do that, but at the time I was trying to get the project finished and since it worked on a Interval as I needed it I just moved on and never inquired why it does this.

 

If you use a method button to execute it, you can set it to a null '' (single quote, single quote) for its initial value.

 

Here is what  I did for reference.

PROGRAM MyTextProgram

METHOD
Exec AT %M(.Trigger ST_EA.Execute):STRING;
END_METHOD
VAR
ParentFolder AT %M(..FullName) : STRING;
END_VAR

VAR_INPUT
ParentFolderInput : STRING;
END_VAR

ParentFolderInput := CONCAT(ParentFolder, '.BI.%');

Exec(ParentFolderInput);

END_PROGRAM

  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA control
  • SCADA data
  • SCADA integration
  • SCADA network
  • SCADA programming
  • SCADA software
  • scada system
  • SCADA tutorial
  • SCADA web application
  • Telemetry and SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

BevanWeiss
Spock BevanWeiss
Spock

Posted: ‎2020-10-09 09:03 PM

0 Likes
1
3207
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-10-09 09:03 PM

When calling ST SQL with parameters, I normally end up having two logic routines.

The first just setups what the 'inputs' to the query are going to be, and then calls Execute on the second logic routine passing in the inputs which are then VAR_INPUTs on the second logic routine.

 

This is mostly related to the way that the 'sequence' of ST execution occurs.

The SQL Logic is part of the 'Input' scan, which means that it occurs at the same time as the VAR variables are initialised.. which is why the SQL Params can't be VAR variables, they MUST be VAR_INPUT variables, which are available to the ST logic PRIOR to the ST executing.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA control
  • SCADA data
  • SCADA integration
  • SCADA network
  • SCADA programming
  • SCADA software
  • scada system
  • SCADA tutorial
  • SCADA web application
  • Telemetry and SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

Hardin4019
Lieutenant Hardin4019
Lieutenant

Posted: ‎2020-10-10 08:42 AM

In response to BevanWeiss
0 Likes
0
3196
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2020-10-10 08:42 AM

Thanks for taking the time to reply and giving me the direction I needed guys.

  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA control
  • SCADA data
  • SCADA integration
  • SCADA network
  • SCADA programming
  • SCADA software
  • scada system
  • SCADA tutorial
  • SCADA web application
  • Telemetry and SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of