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!

Pass data from script to tags and vice versa

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
  • Pass data from script to tags and vice versa
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
37
View All

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
Mehdi_Sajjadi
Lieutenant JG Mehdi_Sajjadi
Lieutenant JG

Posted: ‎2024-09-30 11:07 PM

0 Likes
6
1087
  • 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: ‎2024-09-30 11:07 PM

Pass data from script to tags and vice versa

I am trying to pass generated data from scripting environment to variables used in Database. f

I have tried to run thes3 3 commands in script environment but have not had any success.

I want to pass data from script to database variables and vice versa.

  • Server.findobject
  • Server.GetOpc
  • Server.SetOpc

I read Scada help thoroughly and tried to test examples in there, but it did not work. 

I appreciate if any one help me to let me know if these 3 functions are exactly what I need? and is there any clear explanation about their functionality?

 

Thanks and Regards

Labels
  • Labels:
  • DNP3
  • Logic
  • Mimics
  • SCADA
  • Scripting
  • ViewX
  • Virtual ViewX
  • 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
tfranklin
Commander tfranklin
Commander

Posted: ‎2024-10-01 06:44 AM . Last Modified: ‎2024-10-01 06:47 AM

2 Likes
1
1070
  • 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: ‎2024-10-01 06:44 AM . Last Modified: ‎2024-10-01 06:47 AM

You're on the right track.  If I had to guess, you're probably just not supplying the property that you want to write to. 

 

Here are some examples.  Assume there's a variable string in a path called "Testing.StringVar"

 

Example 1: SetOPCValue -- sets a property of an object

call server.setopcvalue("Testing.StringVar.Value",someStringValueHere)

 

Example 2: GetOPCValue -- gets a property value for an object

myString = server.getopcvalue("Testing.StringVar.Value")

msgbox myString

 

Example 3: FindObject -- creates an object variable with access to all methods/properties of the object using the FULLNAME of an object

set obj = server.findobject("Testing.StringVar")

msgbox obj.interface.value

 

Example 4: LookupObject -- creates an object variable with access to all methods/properties of the object using the ID number of an object.

 

Lets assume the ID number for the StringVar tag is 54321

 

set obj = server.lookupobject(54321)

msgbox obj.interface.value

 

When you use FindObject or LookupObject, you're creating an object variable so you'll typically want to evaluate if the object returned something prior to the next statement.  something like below would work:

 

set obj = server.findobject("Testing.StringVar")

if not obj is nothing then

      'do something here (ex: msgbox obj.fullname)

end if

msgbox obj.interface.value

See Answer In Context

Reply

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

AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2024-10-04 04:22 AM

0 Likes
1
978
  • 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: ‎2024-10-04 04:22 AM

None of the five screenshots in the previous post are visible - they just show a placeholder triangle shape.

 

For DNP3 points you can only control output points (analog and binary), control pulsed actions (null and trip-close) and initialise string points.

 

Using a script to set the current value of an output point will issue a control to the outstation. Attempting to set the current value of an input point will apply a master-station override (if enabled) and fail if disabled.

 

You can also do this by invoking the "Control" method, which is on the output point's "Control" aggregate:

Set Point = Server.FindObject("My DNP3 Analog Output Point")
Point.Interface.Control.Control 1234

where 1234 is the value to control the analog output point to.

 

For string points use the "SetValue" method:

Set Point = Server.FindObject("My DNP3 String Point")
Point.Interface.SetValue "Hello world"

Andrew Scott, R&D Principal Technologist, AVEVA

See Answer In Context

Reply

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

Replies 6
tfranklin
Commander tfranklin
Commander

Posted: ‎2024-10-01 06:44 AM . Last Modified: ‎2024-10-01 06:47 AM

2 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: ‎2024-10-01 06:44 AM . Last Modified: ‎2024-10-01 06:47 AM

You're on the right track.  If I had to guess, you're probably just not supplying the property that you want to write to. 

 

Here are some examples.  Assume there's a variable string in a path called "Testing.StringVar"

 

Example 1: SetOPCValue -- sets a property of an object

call server.setopcvalue("Testing.StringVar.Value",someStringValueHere)

 

Example 2: GetOPCValue -- gets a property value for an object

myString = server.getopcvalue("Testing.StringVar.Value")

msgbox myString

 

Example 3: FindObject -- creates an object variable with access to all methods/properties of the object using the FULLNAME of an object

set obj = server.findobject("Testing.StringVar")

msgbox obj.interface.value

 

Example 4: LookupObject -- creates an object variable with access to all methods/properties of the object using the ID number of an object.

 

Lets assume the ID number for the StringVar tag is 54321

 

set obj = server.lookupobject(54321)

msgbox obj.interface.value

 

When you use FindObject or LookupObject, you're creating an object variable so you'll typically want to evaluate if the object returned something prior to the next statement.  something like below would work:

 

set obj = server.findobject("Testing.StringVar")

if not obj is nothing then

      'do something here (ex: msgbox obj.fullname)

end if

msgbox obj.interface.value

Reply

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

Mehdi_Sajjadi
Lieutenant JG Mehdi_Sajjadi
Lieutenant JG

Posted: ‎2024-10-01 07:28 PM

In response to tfranklin
0 Likes
0
1028
  • 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: ‎2024-10-01 07:28 PM

Thank you so much

 

I have tested them all and regardless of which function I am using I  am receiving this error message.  I tried to change configuration in Webex in server configuration, but no success. 

error.png

 

Any suggestion about this issue? 

 

Thanks and regards

Reply

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

AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2024-10-03 07:22 AM

0 Likes
1
1026
  • 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: ‎2024-10-03 07:22 AM

Without seeing the script that generates this error there isn't sufficient information to go on.


Andrew Scott, R&D Principal Technologist, AVEVA
Reply

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

Mehdi_Sajjadi
Lieutenant JG Mehdi_Sajjadi
Lieutenant JG

Posted: ‎2024-10-03 08:21 PM

In response to AndrewScott
0 Likes
0
991
  • 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: ‎2024-10-03 08:21 PM

Hi Andrew

 

These are test scripts to check Server Function outcomes. 

 

X = Server.GetOPCValue("From_Scrpt.Value")  Send value from Database to Script

GetOpc.png
Msgbox "The value from Database is:" & x: After I run the Script, the result will be:

run script.png

 

 

 

z = Inputbox ("Insert the value:") 

insert variable to script.png
server.SetOPCValue "To_Script.Value" , Cint(z) Set database value from script

Msgbox "The value from Script is:" & To_Script.Value Display database value 

Script value result.png

but I can see the value in the box that I dragged from database to mimic. 

value.png

 

These commands are only working for INTERNAL VARIABLES. 

the main issue is thatI cannot send to DNP3 points to I can forward them to RTU?

 

Thanks and Regards

 

 

Reply

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

AndrewScott
Admiral AndrewScott
Admiral

Posted: ‎2024-10-04 04:22 AM

0 Likes
1
979
  • 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: ‎2024-10-04 04:22 AM

None of the five screenshots in the previous post are visible - they just show a placeholder triangle shape.

 

For DNP3 points you can only control output points (analog and binary), control pulsed actions (null and trip-close) and initialise string points.

 

Using a script to set the current value of an output point will issue a control to the outstation. Attempting to set the current value of an input point will apply a master-station override (if enabled) and fail if disabled.

 

You can also do this by invoking the "Control" method, which is on the output point's "Control" aggregate:

Set Point = Server.FindObject("My DNP3 Analog Output Point")
Point.Interface.Control.Control 1234

where 1234 is the value to control the analog output point to.

 

For string points use the "SetValue" method:

Set Point = Server.FindObject("My DNP3 String Point")
Point.Interface.SetValue "Hello world"

Andrew Scott, R&D Principal Technologist, AVEVA
Reply

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

Mehdi_Sajjadi
Lieutenant JG Mehdi_Sajjadi
Lieutenant JG

Posted: ‎2024-10-07 03:44 PM

In response to AndrewScott
0 Likes
0
928
  • 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: ‎2024-10-07 03:44 PM

Dear Andrew

Thank you so much for your help. 

I did not know about our data type limitation that we can use in these functions. Very helpful. 

I have copied & pasted test codes for your reference, plus screen shots of outcomes.

 

1-READ Value  from DATABASE:

X = Server.GetOPCValue("From_Scrpt.Value")
Msgbox "The value from DataBase is:" & x

 

2-WRITE Value to DATABASE:

z = Inputbox ("Insert the value:")
server.SetOPCValue "To_Script.Value" , Cint(z)
Msgbox "The value from Script is:" & To_Script

 

3-WRITE Value to DATABASE (DNP3):

set Point = Server.FindObject ("Control_Output")
Point.Interface.Control.Control 1234
Msgbox "The obj value is :" & Point.Interface.CurrentValue

 

 

I have attached outcome of running codes in attachment. There are 2 issues:

  1. I cannot see value in box created in No.2
  2. Error message create at No.3

 

Attachments
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