Set To across multiple channels


Recommended Posts

I would like to ask the user for an input with a Variable Value Component and have it span several channels. I have am using the Action Set To and my Action Channel is Channel.*ChannelName1*.timing. I want this to go to another channel (ex: Channel.*ChannelName2*.timing) as well, but putting this in Action Channel doesn't update the second channel. I try to separate the Action Channel's by a simple space, a comma, a period, and a semicolon. Notta. If I add another action Set To, it asks the user for a second input. I cannot allow this.

How can I ask thee user for one input and have it span multiple channels?

Link to comment
Share on other sites

Two ways: if you always want the input from one to go to a second channel, just use the event of the first channel.  So say you have ChannelA and ChannelB.  In the event for ChannelA put:

ChannelB = ChannelA[0]

Then every time you change channelA, it will also change channelB.  Just DO NOT also put the event in ChannelB!  Otherwise you will get a loop and hang DAQFactory!

The other way would be to use script to ask for the value.  The general template (with added duplication) would be:

private string data = system.entryDialog("Enter a new Value:")
if (!isempty(data))
   channelA = strToDouble(data)
   channelB = strToDouble(data)
endif

Link to comment
Share on other sites

Brilliant, thanks! FYI, anyone else, the system.entryDialog can take min, max, default, and other stuff. And I wanted to change only the timing aspect of the channels, so my quick script became:

private string datain = system.entryDialog("Channel Timing (all channels):",0.005,,channel.channelA.timing)

if (!isempty(datain))
   channel.channelA.timing = strToDouble(datain)
   channel.channelB.timing = strToDouble(datain)
endif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.