ifDollarDefined() and RootPanelOnModule generates Warnings

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
7 posts • Page 1 of 1
moto3101
Posts:37
Joined: Tue Aug 22, 2017 2:04 pm

ifDollarDefined() and RootPanelOnModule generates Warnings

Post by moto3101 »

Hello together,

In the init of the panel, we are using ifDollarDefined("$foo"), still we are getting warnings about missing $ parameters when loading this panel in a module.

I just wanted to know if there is a way to prevent WinCC OA from generating these warnings when loading panels on modules without providing the respective dollar parameters in the rootPanelOnModule method.

Thanks and with best regards,
moTo

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by fmulder »

You probably have something like this in your code:

Code: Select all

string strFoo = $foo;
I've also seen messages like you say when you define the variable as a panel global variable in your Scopelib.

* Do not define the variable with the $ in your scopelib
* Define the variable in your EventInitialize (with or without isDollarDefined)

The better way to do this is, which will keep away the error message is:

Code: Select all

string strFoo;

if( isDollarDefined( "$Foo" ))
{
  strFoo = $Foo;
}
p.s.
I often use this trick to test my panels. When I make an icon then I make sure that it runs with a dollar code or without a dollar code.

Example:

Code: Select all

string strDatapoint = "MYVALVE";  // Use a default datapoint for testing

// This icon can be used with or without the dollar code
if( isDollarDefined( "$datapoint" ))
{
  strDatapoint = $Datapoint;
}
Hope this helps

share the fun
Frenk Mulder

moto3101
Posts:37
Joined: Tue Aug 22, 2017 2:04 pm

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by moto3101 »

Hello Frenk,

thanks for your reply.
You probably have something like this in your code:

Code: Select all

string strFoo = $foo;
No we don't, that's the thing that confuses me. We are defining the variable in the scope lib:

Code: Select all

string strDatapoint = "";
and in the init we have

Code: Select all

if( isDollarDefined( "$dp" ))
{
  strDatapoint = $dp;
}
Still, when loading a panel in a module without providing the dp parameters we get the error.

Code: Select all

RootPanelOnModule("Folder/panel.pnl","Foo","BarModule",makeDynString();
CTRL, WARNING, 51, Parameter incorrect, did not find the $-parameter, $dp
PARAM,WARNING, 81, Syntax error, $-Parameter, Module: BarModule
If we are using

Code: Select all

RootPanelOnModule("Folder/panel.pnl","Foo","BarModule",makeDynString($dp:);
the error vanishes.

Personally, I don't see the point in throwing errors if we are checking if the parameter is defined.

Best regards,
moTo

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by fmulder »

We do 'string strDP' in the scopelib.
We assign the dollar code in the EventInitialize.

Do not mention "$DP" in the scopelib.

We had the same issue. Our rule now is : no $ codes in the scopelib

Good luck

Frenk Mulder

moto3101
Posts:37
Joined: Tue Aug 22, 2017 2:04 pm

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by moto3101 »

Hi Frenk,

its not in the scope lib. Its in the EventInitialize of the panel, as mentioned above.

Best regards,
moTo Image
Attachments
eventInit.png

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by mkoller »

Are we talking about an issue with $-parameters throwing warnings when using XML Panel files, which has been solved in 3.15 P8 ?

moto3101
Posts:37
Joined: Tue Aug 22, 2017 2:04 pm

Re: ifDollarDefined() and RootPanelOnModule generates Warnings

Post by moto3101 »

Dear Martin,

we are using .pnl files. However, we are not using 3.15 but 3.14.

Best regards,
moTo

7 posts • Page 1 of 1