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

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Using the API to access Historical Data from a DMZ server

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
  • Using the API to access Historical Data from a DMZ server
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
307
AndrewScott
Admiral AndrewScott
96
BevanWeiss
Spock BevanWeiss
90
AdamWoodlandToo
Lt. Commander AdamWoodlandToo
36
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
bmcneer
Crewman bmcneer
Crewman

Posted: ‎2022-07-18 07:13 AM . Last Modified: ‎2023-05-02 11:54 PM

0 Likes
2
1095
  • 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: ‎2022-07-18 07:13 AM . Last Modified: ‎2023-05-02 11:54 PM

Using the API to access Historical Data from a DMZ server

I was hoping to use an Excel Add-In to replicate some of the functionality of something like PI Data Link.  I originally tried using queries against CDBHistoric and was able to successfully retrieve values but this didn't seem like a scalable solution since it seemed to be fairly slow when there was a significant amount of records needed and each record was a separate query

 

I did find this solution in the forum for using InvokeMethod:

Solved: Getting historic data via .NET client API - Communities (se.com)

 

but I am unable to use this since the server is a DMZ server and it won't allow the InvokeMethod to be used

Labels
  • Labels:
  • SCADA
  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA software
  • SCADA tutorial
  • 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
sbeadle
Kirk sbeadle Kirk
Kirk

Posted: ‎2022-07-18 11:57 PM

In response to BevanWeiss
0 Likes
0
1063
  • 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: ‎2022-07-18 11:57 PM

The first InvokeMethod in that example will write data, so would be blocked on the DMZ. The others read data.

Alternatives include:

a) Use the c# API to read history

HistoricTag tag = new HistoricTag(PointName + "." + HistoricAggregateName, 0, 0, 0);
var tags = new HistoricTag[1];
tags[0] = tag;

var historicItems = AdvConnection.ReadRawHistory(LastChangeDate, DateTime.UtcNow, LastReadCount, false, tags);

b) Query SQL from the c# API

			// Connect to database
			ClearScada.Client.Simple.Connection SimpleConnection;
			ServerNode node = new ClearScada.Client.ServerNode("127.0.0.1", 5481);
			SimpleConnection = new ClearScada.Client.Simple.Connection("Utility");
			SimpleConnection.Connect(node);
			var AdvConnection = SimpleConnection.Server;
			SimpleConnection.LogOn( UserName.Text, password.SecurePassword);
			// Query points

			string sql = "SELECT O.FullName As OName, O.TypeDesc FROM CHistory H INNER JOIN CDBObject O ON H.Id=O.Id WHERE OName LIKE '" + NameFilter.Text + "' ORDER BY OName";
			ClearScada.Client.Advanced.IQuery serverQuery = AdvConnection.PrepareQuery(sql, new ClearScada.Client.Advanced.QueryParseParameters());
			ClearScada.Client.Advanced.QueryResult queryResult = serverQuery.ExecuteSync(new ClearScada.Client.Advanced.QueryExecuteParameters());
			if (queryResult.Status == ClearScada.Client.Advanced.QueryStatus.Succeeded || queryResult.Status == ClearScada.Client.Advanced.QueryStatus.NoDataFound)
			{
				if (queryResult.Rows.Count > 0)
				{
					Dispatcher.Invoke(new Action(() => {
						listBox.Items.Clear();
					}));
					IEnumerator<ClearScada.Client.Advanced.QueryRow> rows = queryResult.Rows.GetEnumerator();
					while (rows.MoveNext())
					{
						Console.WriteLine( (string)rows.Current.Data[0] + " (" + (string)rows.Current.Data[1] + ")" );
					}
				}
				else
				{
					MessageBox.Show("Database query no data");
					return;
				}
			}
			else
			{
				MessageBox.Show("Database query error");
				return;
			}
			serverQuery.Dispose();

 

See Answer In Context

  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA software
  • SCADA tutorial
  • Telemetry and SCADA
Reply

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

Replies 2
BevanWeiss
Spock BevanWeiss
Spock

Posted: ‎2022-07-18 10:19 PM

0 Likes
1
1071
  • 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: ‎2022-07-18 10:19 PM


@bmcneer wrote:

...it seemed to be fairly slow when there was a significant amount of records needed and each record was a separate query


I'm confused by why you had each record as a separate query.

If you're only getting historic aggregates (like Min/Max/Average) then you really want to minimize the round trips.

 

You can do this in several ways.  How I would recommend is:

1. Retrieve a list of the IDs of the various objects you want the historical data for

2. Issue the historic query and use the WHERE ID IN {...} to filter the result for the objects (based on the IDs you had before)

3. Then you can split out the result back to the IDs that you wanted

 

If you're doing this as a UDF type of situation, then it is indeed going to be trickier, since each formula will have its own context.

 

The .NET Client does have an ability to execute a Query, from memory this was more performant than instantiating an ODBC client etc.  Especially if you already have such a connection cached.

 

I'm a bit surprised that the InvokeMethod isn't capable of being used on a client connected to the DMZ server.

What error message does it provide for this?


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 software
  • SCADA tutorial
  • Telemetry and SCADA
Reply

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

sbeadle
Kirk sbeadle Kirk
Kirk

Posted: ‎2022-07-18 11:57 PM

In response to BevanWeiss
0 Likes
0
1064
  • 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: ‎2022-07-18 11:57 PM

The first InvokeMethod in that example will write data, so would be blocked on the DMZ. The others read data.

Alternatives include:

a) Use the c# API to read history

HistoricTag tag = new HistoricTag(PointName + "." + HistoricAggregateName, 0, 0, 0);
var tags = new HistoricTag[1];
tags[0] = tag;

var historicItems = AdvConnection.ReadRawHistory(LastChangeDate, DateTime.UtcNow, LastReadCount, false, tags);

b) Query SQL from the c# API

			// Connect to database
			ClearScada.Client.Simple.Connection SimpleConnection;
			ServerNode node = new ClearScada.Client.ServerNode("127.0.0.1", 5481);
			SimpleConnection = new ClearScada.Client.Simple.Connection("Utility");
			SimpleConnection.Connect(node);
			var AdvConnection = SimpleConnection.Server;
			SimpleConnection.LogOn( UserName.Text, password.SecurePassword);
			// Query points

			string sql = "SELECT O.FullName As OName, O.TypeDesc FROM CHistory H INNER JOIN CDBObject O ON H.Id=O.Id WHERE OName LIKE '" + NameFilter.Text + "' ORDER BY OName";
			ClearScada.Client.Advanced.IQuery serverQuery = AdvConnection.PrepareQuery(sql, new ClearScada.Client.Advanced.QueryParseParameters());
			ClearScada.Client.Advanced.QueryResult queryResult = serverQuery.ExecuteSync(new ClearScada.Client.Advanced.QueryExecuteParameters());
			if (queryResult.Status == ClearScada.Client.Advanced.QueryStatus.Succeeded || queryResult.Status == ClearScada.Client.Advanced.QueryStatus.NoDataFound)
			{
				if (queryResult.Rows.Count > 0)
				{
					Dispatcher.Invoke(new Action(() => {
						listBox.Items.Clear();
					}));
					IEnumerator<ClearScada.Client.Advanced.QueryRow> rows = queryResult.Rows.GetEnumerator();
					while (rows.MoveNext())
					{
						Console.WriteLine( (string)rows.Current.Data[0] + " (" + (string)rows.Current.Data[1] + ")" );
					}
				}
				else
				{
					MessageBox.Show("Database query no data");
					return;
				}
			}
			else
			{
				MessageBox.Show("Database query error");
				return;
			}
			serverQuery.Dispose();

 

  • Tags:
  • english
  • scada
  • SCADA app
  • SCADA software
  • SCADA tutorial
  • 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