DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

chnnostr in statblockcalc

Ok, I am not sure why this won't work.  I am trying to call StatBlockCalc and use channels that I select using the Chnget function.

This code works fine:

Call Chnget (3,0,channels)
chnnostr = "2-chnnomax"
Call StatBlockCalc("channel","1-10",chnnostr)

However, I would really like to use something like this:

Call Chnget (3,0,channels)
chnnostr = "chnno1, chnno2, chnnomax"
Call StatBlockCalc("channel","1-10",chnnostr)

Any tips?

Thanks, Tom
0 Kudos
Message 1 of 3
(3,359 Views)
Hi Tom,
I'm not sure why you select three channels if you only want to use two of them, so here are several suggestions:

1. You can select a list of channels in the ChnGet dialog box using for a range of channels like 1-3 or to pick several channels like 1,3,5. The advantage is that you don't have to care for the string with the channel list but just use ChnNoStr1 in the sequel:
Call Chnget (0,1,"Channel selection")
Call StatBlockCalc("channel","1-10",ChnNoStr1)

2. You can pick several channels in the ChnGet dialog box with
Call Chnget (2,0,"Channel selection")
Chn_string = ChnStrAdd("",ChnNo1)
Chn_string = ChnStrAdd(Chn_string,ChnNo2)
Call StatBlockCalc("channel","1-10",Chn_string)
The advantage of ChnStrAdd is, that it automatically clears the string from blanks, works fine if you exchange the numbering and deletes channels that are entered more than once.

3. If you need a range of channels and don't want to use #1 you have to build the channel list string yourself:
Call Chnget (2,0,"Channel selection")
Chn_string = chnno1 & "-" & chnno2
Call StatBlockCalc("channel","1-10",Chn_string)
Please take care to avoid blanks in the channel list (i.e. use 1-3, NOT: 1 - 3).

Hope that helps,
Ralf
0 Kudos
Message 2 of 3
(3,332 Views)

Hi Tom,

The reson your code is not working for you is a simple syntactical one.  Try this instead:

Call Chnget (3,0,channels)
chnnostr = chnno1 & ", " & chnno2 & ", " & chnnomax
Call StatBlockCalc("channel","1-10",chnnostr)

The reason for this is that you want to append the VALUE of these integer variables into the new ChnNoStr string variable, not the NAMES of these integer variables.  Just execute a "MsgBox ChnNoStr" to see the difference.

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 3
(3,326 Views)