isDollarDefined()

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
4 posts • Page 1 of 1
peka
Posts: 19
Joined: Wed May 15, 2013 4:46 pm

isDollarDefined()

Post by peka »

Hello,

first of all my setup:
OS: Win7 Pro x64
WinCC OA: 3.11+SP1, Patch6

I want to set a reference-button's label dynamic by $-Parameter. When I place the reference via Gedi, $Param's initial value is $Param. So far so good. Using the code following next, i get log warnings (btw. "Syntax error" results in a warning msg?):

WCCOAui (2), 2013.07.29 17:56:03.898, CTRL, WARNING, 51, Parameter incorrect, did not find the $-parameter, $BOILER_NAME
WCCOAui (2), 2013.07.29 17:56:03.898, PARAM,WARNING, 81, Syntax error, $-Parameter, Module: _QuickTest_
Panel: xxx\\panels\\newPanel.pnl []
In reference: objects\\btnBcsParameter.pnl Group: 2 named: "PANEL_REF2"

Code: Select all

// [(Panel)] [0] - [Initialize]
main()
{
DebugTN(isDollarDefined("$BOILER_NAME"));
  setValue("btnBcsParam", "text", "BCS" + ((isDollarDefined("$BOILER_NAME") && getDollarValue("$BOILER_NAME") != "")
                                           ? " (" + $BOILER_NAME + ")"
                                           : ""));

}
isDollarDefined() return always true (ok, defined "by Gedi"), so i'd expect no warning.

Tried several variant (using variables, if-condition,working only with getDollarValue -> Gedi does not find $-Param -> no value setting possibility...) - what would you suggest?

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: isDollarDefined()

Post by leoknipp »

Hello,

I made a test using the function isDollarDefined(). As described in the online help this function shall be used at child-panels when the panels are opened.
The function cannot be used to detect if $-parameters are defined when inserting references directly into a panel (using the graphical editor). When inserting a panel as a reference the $-parameters need to be pre-defined at the reference panel. Therefore the function might return always "true".

For my test I created two simple panels.
At the first panel "panel A" I added a button to open the second panel "panel B". At this script I defined that $-parameters shall be passed to the child panel "panel B".
A script a "panel B" is calling the function isDollarDefined() to check if a specific $-parameter was passed at the command to open the panel.

In this case the function isDollarDefined() is working correctly and I got only the result "true" if the $p-parameter was defined at the command to open the panel.

Best Regards
Leopold Knipp
Senior Support Specialist

n_lev
Posts: 73
Joined: Tue May 28, 2013 2:24 am

Re: isDollarDefined()

Post by n_lev »

Hi Petr,

My experience with isDollarDefined() is exactly what Leopold described.

I'm a bit confused by the description of your problem though. If you define the script that you've shown in the reference object and then insert that reference object into the panel than you $BOILER_NAME should be shown in the object properties. I think it's value defaults to '$BOILER_NAME' (same as $-parameter name). If you leave it like that, I think you'll get the errors. Try changing it to empty text or any text.

peka
Posts: 19
Joined: Wed May 15, 2013 4:46 pm

Re: isDollarDefined()

Post by peka »

Hello,

thanks for reply. I wanted exactly what the function isn't intended to ("The function cannot be used to detect if $-parameters are defined when inserting references directly into a panel"). However, i'd expect to get any value for getDollarValue, empty string or at least the $-name when the object was placed via gedi and the $-Param was not set (as no value is a value, too).

@Nick: the example I mentioned was the "light version" from what I wanted. And setting the $-Param manually with an empty string via Gedi was exactly what i wanted to avoid, maybe I have gotten a bit lazy. ;)

Post Reply
4 posts • Page 1 of 1