![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: Feb 2006
Location: Sweden
Posts: 82
|
WinCC Pro - msgFilterSQL
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 |
![]() |
![]() |
#2 |
Lifetime Supporting Member
|
The wildcard for some SQL versions is the percent symbol (%).
So [WHERE ] Code:
TEXT3 LIKE 'prefix%'
__________________
_ Brian T. Carcich i) Take care of the bits, and the bytes will take care of themselves. ii) There is no software problem that cannot be solved with another layer of indirection. iii) Measurement is hard. iv) I solemnly swear that I am up to no good ![]() v) I probably have the highest ratio of forum posts to actual applications in the field (but no longer ∞ ![]() vi) Hakuna matata. vii) Bookkeeping. viii) But I should be ignored. |
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Apr 2009
Location: Ger
Posts: 518
|
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. |
![]() |
![]() |
#4 |
Member
![]() ![]() Join Date: Jan 2006
Location: Finland
Posts: 1,973
|
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. |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wincc rt pro to s7 1500 connection | the18 | LIVE PLC Questions And Answers | 3 | November 8th, 2021 04:06 AM |
Multiplex tags in WINCC Pro v15.1 | dahnuguy | LIVE PLC Questions And Answers | 24 | September 29th, 2020 02:57 PM |
WinCC RT Pro / WebNavigator V15.1 and SIMATIC Logon | Hal9000 | LIVE PLC Questions And Answers | 0 | July 3rd, 2019 12:46 PM |
Citect Vs WinCC - Long | Doug_Adam | LIVE PLC Questions And Answers | 22 | October 3rd, 2014 02:56 PM |
WINCC PRO V11 build problem with (0 errors, 0 warnings) | Yessin | LIVE PLC Questions And Answers | 0 | May 15th, 2013 03:14 AM |