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

One Time Read a File

SmartConnector Forum

Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.

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
  • EcoStruxure Building
  • SmartConnector
  • SmartConnector Forum
  • One Time Read a File
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
JeffBowman
Sisko JeffBowman Sisko
164
ardak
ardak Schneider Alumni (Retired)
34
sesa180908_brid
Commander sesa180908_brid Commander
34
mike_meirovitz
Commander mike_meirovitz
21
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SmartConnector Forum
Solved
Kanber
Commander | EcoXpert Master Kanber Commander | EcoXpert Master
Commander | EcoXpert Master

Posted: ‎2019-06-13 06:38 AM

0 Likes
9
1572
  • 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.

‎2019-06-13 06:38 AM

One Time Read a File

Hi,

 

I have one text file for read tag names and I don't what to lost time every time to read the text file. I want to read only when smart connector service is start.

Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2019-06-13 08:10 AM

2 Likes
0
1551
  • 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.

‎2019-06-13 08:10 AM

Hi Kanber,

 

I think it goes back to my first response, and what @Adam_Summers  was mentioning about using the In memory cache. The in memory cache is cleared whenever Smart Connector restarts. So this will accomplish what you are looking for. (e.g. not reading the file every time)

 

var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");

if (cachedFileRead == null)

{

    var readFileResults = ReadTheFile();

    Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");

    _tagList= readFileResults;

}

else 

{

    _tagList= cachedFileRead;

}

 

You can add code similar to the above in your Execute_Subclass method. Most likely, this code will be at the start of your Execute_Subclass method. _tagList is a private field of your class where which is whatever type your tag list is. You can then use _tagList from anywhere else in the class to access it.

 

Regards,

 

-Jeff

See Answer In Context

Reply
Replies 9
Adam_Summers
Lt. Commander Adam_Summers Lt. Commander
Lt. Commander

Posted: ‎2019-06-13 06:47 AM

2 Likes
0
1568
  • 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.

‎2019-06-13 06:47 AM

Hi,

 

Not sure if I fully understand the question but if you want to read something (configuration) once on service start and not on each processor cycle you have 2 options.

 

1) Read and store in memory cache - this stores for the runtime of the service (or until the expiry datetime you set)

2) Read and store in processor values - this survices a reset but could still be updated on first run.

 

For me option 1 is best, it will perform better and provide you a simple way to check if the value you want (config data) exists in cache - if not update it, if it does return fast and use it. A lazy loading approach.

Reply
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2019-06-13 06:50 AM . Last Modified: ‎2019-06-13 06:50 AM

0 Likes
6
1567
  • 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.

‎2019-06-13 06:50 AM

Hi Kanber,

 

The best way to do this, is probably to cache the data the first time the processor runs.

 

var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");

if (cachedFileRead == null)

{

    var readFileResults = ReadTheFile();

    Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");

    TagList = readFileResults;

}

else 

{

    TagList = cachedFileRead;

}

 

 

You could also create a processor, whos job in life is to read the file and add it to the cache, then run that processor on start.

 

Best Regards,

 

-Jeff

Reply
Kanber
Commander | EcoXpert Master Kanber Commander | EcoXpert Master
Commander | EcoXpert Master

Posted: ‎2019-06-13 07:11 AM

0 Likes
5
1564
  • 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.

‎2019-06-13 07:11 AM

Hi Jeff,

 

But I  don't know which code I need to add these. as you know we have;

- Execute_Subclass

- Discover

- SmartConnectorEwsServerSettings

 

which are them working only once which are working every schedule time? I look doucment but I can't solve.

Reply
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2019-06-13 07:26 AM

0 Likes
4
1559
  • 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.

‎2019-06-13 07:26 AM

Hi Kanber,

 

All code in your processors executes out of the Execute_Subclass method. This check is likely something that you do at the start of that.


Regards,

 

-Jeff

Reply
Kanber
Commander | EcoXpert Master Kanber Commander | EcoXpert Master
Commander | EcoXpert Master

Posted: ‎2019-06-13 07:45 AM

0 Likes
3
1557
  • 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.

‎2019-06-13 07:45 AM

Ok I will try.

 

which method working with schedule time? I mean when we add dll file on smart connector and edit schedule lets say 10 min. every 10 min which method is fisrt running.

Reply
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2019-06-13 07:56 AM

1 Like
2
1555
  • 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.

‎2019-06-13 07:56 AM

Hi Kanber,

 

The Execute_Subclass method is the entrypoint of the processor, so if you setup a schedule, this method will ALWAYS be run first. Your code should start from in that.

 

In order to setup a schedule you just need to create a Configuration Schedule with setting similar to the below:

 

2019-06-13_10-53-43.png

 

And then set your processor to run on a schedule.a
2019-06-13_10-51-10.png

And finally set the schedule on the processor:

 

2019-06-13_10-55-36.png

Best Regards,

 

-Jeff

Reply
Kanber
Commander | EcoXpert Master Kanber Commander | EcoXpert Master
Commander | EcoXpert Master

Posted: ‎2019-06-13 08:06 AM

0 Likes
1
1553
  • 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.

‎2019-06-13 08:06 AM

that mean these is not what I am looking for.

 

I want to one method which will run when windows is open and smart connector service start to running and first time when dll was called. then it will read text file once and on scheduled timed it will not read file again and again.

 

 

Reply
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2019-06-13 08:10 AM

2 Likes
0
1552
  • 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.

‎2019-06-13 08:10 AM

Hi Kanber,

 

I think it goes back to my first response, and what @Adam_Summers  was mentioning about using the In memory cache. The in memory cache is cleared whenever Smart Connector restarts. So this will accomplish what you are looking for. (e.g. not reading the file every time)

 

var cachedFileRead = Cache.RetrieveItem<FileReadResultType>("TheCacheItemKey");

if (cachedFileRead == null)

{

    var readFileResults = ReadTheFile();

    Cache.AddOrUpdateItem(readFileResults, "TheCacheItemKey");

    _tagList= readFileResults;

}

else 

{

    _tagList= cachedFileRead;

}

 

You can add code similar to the above in your Execute_Subclass method. Most likely, this code will be at the start of your Execute_Subclass method. _tagList is a private field of your class where which is whatever type your tag list is. You can then use _tagList from anywhere else in the class to access it.

 

Regards,

 

-Jeff

Reply
Anonymous user
Not applicable

Posted: ‎2019-08-02 05:27 AM . Last Modified: ‎2019-08-02 05:28 AM

0 Likes
0
1538
  • 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.

‎2019-08-02 05:27 AM

Hi @Kanber,

 

Did you find the solution on the replies above?
 
If yes, please click on "Accept as Solution" at the bottom right corner of the answer which solved your problem.
 
You can also thanks the members who tried to help you by liking their comments!
 

Reply
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