DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find a word in the channels name?

Solved!
Go to solution

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

 

 

0 Kudos
Message 1 of 5
(5,617 Views)
Solution
Accepted by topic author fmanuel

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

0 Kudos
Message 2 of 5
(5,598 Views)

Thanks 🙂

 

Do you know the function which allow to add some characters at the end of a character chain?

 

Like "ichwilleinbier"+"trinken" => "ichwilleinbiertrinken"

 

Fred

0 Kudos
Message 3 of 5
(5,592 Views)

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

0 Kudos
Message 4 of 5
(5,588 Views)

Hi

 

Sorry I dont know VBS but thanks 😉

0 Kudos
Message 5 of 5
(5,585 Views)