WinCC Pro - msgFilterSQL

Weo

Member
Join Date
Feb 2006
Location
Sweden
Posts
82
I'm little stucked and ask for small help from one with little more experience of vb script.

So, I have alarm control window Control1[Alarm control] which I need to filter when the screen is loaded. The filter is not constant but indirect (tagprefix).
As you see I added msgbox in end, and can confirm that the tagprefix is correct.

My script is like this today, but is not working:
(The script does work when I add my actual tagprefix as a constant i.e M1)
Guess there should be some wildcard around my prefix and I'm pretty close?

Sub OnGenerateScreen()
Dim prefix
prefix = Parent.Parent.Parent.TagPrefix

ScreenItems("Control1").MsgFilterSQL = "TEXT3 LIKE 'prefix' "

MsgBox prefix
End Sub
 
The wildcard for some SQL versions is the percent symbol (%).


So [WHERE ]

Code:
TEXT3 LIKE 'prefix%'
would select records where the TEXT3 character field started with the string "prefix" e.g. TEXT3="prefix"; TEXT3="prefixXIFERP"; TEXT3="prefix_whatever"; etc.
 
I think you just have to insert the string value of prefix, like:

ScreenItems("Control1").MsgFilterSQL = "TEXT3 LIKE '" & prefix & "'"

Maybe you have to escape the single quotes in VBscript.
 
I think that it would be simply on vbs code



ScreenItems("Control1").MsgFilterSQL = "TEXT3 LIKE" & prefix


as your prefix is variable and you read it's data and add it to constant string.
 

Similar Topics

Is it possible to convert the project in Wincc Professional to Wincc advance?
Replies
6
Views
1,728
Hello, I used TIA Portal v15.0 to create a project with s7 1511 and wincc rt professional and an IO Controller. using profinet to connect all 3...
Replies
3
Views
2,958
Hello all, In an WinCC Professional v15 application I need to filter the alarms by alarm class, not using the filter button on the toolbar of the...
Replies
3
Views
2,532
Hello all, I have a WinCC Project (Pro V16) connected to Information server 2014 SP3. Everything is configured and works as intended using the...
Replies
0
Views
1,471
I am doing something no one else has ever done.... I want a screen that lists all the faults that have occurred in the resent past on one screen...
Replies
16
Views
6,511
Back
Top Bottom