passing string to $ sign from scripts

Find and share HowTos to various installations / configurations!
5 posts • Page 1 of 1
ray78
Posts:5
Joined: Thu Apr 05, 2018 2:23 am

passing string to $ sign from scripts

Post by ray78 »

Hi there,

I am trying to display the comments of data points (defined as DPE description in Common tab) in a new screen. below is my code:

void MIL_NavigateToPage(string sSiteNo, string sSiteType)
{

string sVal1;
string sText1;

sVal1 = "$dpe_value1:System1:"+sSiteNo+""+sSiteType+"-Status.BURST_STATUS";

sText1 = dpGetComment("System1:42045.FlumeGate-R-Status.CTRL_SUSPENDED");
DebugN("first text:",sText1);

sText1 = "$dpe_Text1:"+sText1;
DebugN("second text:",sText1);

DebugN("value :",sVal1);

RootPanelOn("MIL_Panels/MIL_DEVICES/FlumeGateR/FlumeGateR_Overview.pnl",
"",
makeDynString(sVal1,sText1,"$dpe_value2:System1:42045.FlumeGate-R-Status.CTRL_SUSPENDED"));
}

The sVal1 value is shown on the page with no problem but the text is not showing, looking at the log viewer below will see the assignment. The $dpe_value1 has the data point name in there but for $dpe_Text1 I couldn't use the dataoint instead I used the string variable I had built from the dpGetComment looks like the assignment is not done correctly because text doesn't appear on the screen. Whats is the right syntax to assign a string to a $ value?

WCCOAui1:["first text:"]["42045 Control Suspended"]
WCCOAui1:["second text:"]["$dpe_Text1:42045 Control Suspended"]
WCCOAui1:["value :"]["$dpe_value1:System1:42045.FlumeGate-R-Status.BURST_STATUS"]

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: passing string to $ sign from scripts

Post by leoknipp »

The Debug messages are written before opening the panel using RootPanelOn(). Therefore I cannot see if passing the parameters to the panel worked or not.
How did you check that the $-parameters do not have the correct values in the panel MIL_Panels/MIL_DEVICES/FlumeGateR/FlumeGateR_Overview.pnl?



Info: If you are not using a distributed system or if you want to read data for the own system (in a distributed system) there is no need to use the system name in any function referring to data point elements.

Best Regards
Leopold Knipp
Senior Support Specialist

ray78
Posts:5
Joined: Thu Apr 05, 2018 2:23 am

Re: passing string to $ sign from scripts

Post by ray78 »

Hi Leopold,

I don't know exactly how I can use DebugN to see if the parameters are assigned to the panel correctly. Can you advise what Debug syntax I should use for that?

I know the assignment didn't work because it is not appearing in the panel. So I used DebugN to see what parameters are passed to the RootPanelOn function. I understand how to assign data points and that's how I built sVal1 but in the panel there are texts which I also like to assign them in this script so I built sText1 but this contains string and when I assign the string to the $dpe_Text1 parameter in my script it has the following format: "$dpe_Text1:42045 Control Suspended".
My question is how do I pass a string or a comment (42045 Control Suspended) to the parameter ($dpe_Text1) looks like the format is not correct maybe there is another syntax to assign the strings.

This is a distributed system that;s why I am using the System1 name.

I attached the copy of the project the code is in the click section of Overview Panel. https://www.winccoa.com/fileadmin/image ... MASTER.zip
Attachments
MIL_MASTER.zip
(3.05 MiB) Downloaded 174 times

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: passing string to $ sign from scripts

Post by leoknipp »

The syntax looks like it is okay for passing a $-parameter.
In the panel which is opened you can simply do a DebugN($parameter); (e.g. in the Initialize event of the panel) to see which values was assigned to a $-parameter.

Best Regards
Leopold Knipp
Senior Support Specialist

ray78
Posts:5
Joined: Thu Apr 05, 2018 2:23 am

Re: passing string to $ sign from scripts

Post by ray78 »

I found that the $Parameter I used in the child panel had a duplicate name in another child panel and that confused the assignment. Once I changed the name of $parameter to something else it started working.

5 posts • Page 1 of 1