01-14-2013 08:41 AM
Hello,
I want to search a word into a channel name
For exemple I have 3 channels:
1 Re_treffensiemich
2 Re_treffensiemich_ouipourquoipas
3 Jaimele_pate
I already selected the first one "Re_treffensiemich".
I want to detect the "Re_treffensiemich_ouipourquoipas", his channel number (2) and read also the "_ouipourquoipas"
So I search something to find one part of a character chain
How may I do that?
Thanks for help
Fred
Solved! Go to Solution.
01-15-2013 05:55 AM
Hi Fred
I hope the following script solves your problem. It compares all channels in all groups with a string.
Dim oGroups, oOneGroup, oChannels, oOneChannel, sChnName, sSearchText sSearchText = "treffensiemich" Set oGroups = Data.Root.ChannelGroups For Each oOneGroup in oGroups Set oChannels =oOneGroup.Channels For Each oOneChannel in oChannels sChnName = oOneChannel.Properties("name").Value If InStr (1, sChnName, sSearchText, vbTextCompare) > 0 Then ' Do Something Call Msgbox (sChnName) End If Next Next
Regards
Winfried
01-15-2013 06:41 AM
Thanks 🙂
Do you know the function which allow to add some characters at the end of a character chain?
Like "ichwilleinbier"+"trinken" => "ichwilleinbiertrinken"
Fred
01-15-2013 07:02 AM - edited 01-15-2013 07:07 AM
Hi Fred,
that is standard VBS. See for example http://zone.ni.com/reference/de-XX/help/370858K-0113/vbs/general/vbs_overview/
You can use + but better use & to concatenate strings
sVoll = "ichwilleinbier"&"trinken"
Call MsgBox(sVoll)
Winfried
01-15-2013 07:09 AM
Hi
Sorry I dont know VBS but thanks 😉