From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-16-2017 03:35 PM
Hello, I get the above error code while trying to edit an existing task programmatically. I know it means that the channel already exists in the task, and you cannot have duplicate channels. I do not want duplicate channels - I want to edit the existing one. I am using the create virtual channel vi, which is probably where my error is, as the channel already exists, so I cannot re-create it as a duplicate. The issue is that I want my users to be able to edit the channel names at run time without opening MAX and creating a task. There will be an initial template, but then they will be able to save the new configuration with a new name, and recall it at a later date if desired. They do not know MAX, I do not want to have to teach them how to use it, and it is not intuitive to my techs. I want to reinvent the wheel. I can edit almost everything about the channel using the property nodes, but I cannot find a property to edit the channel name. I know I'm going to feel foolish when the question gets answered, but I have spent way too much time unsuccessfully trying to figure it out myself. I am using a cDaq-9178 with an NI-9205 as module 2, and LabVIEW 2017 Developer's Suite.
Solved! Go to Solution.
08-16-2017 04:15 PM - edited 08-16-2017 04:21 PM
Edit: Nope this isn't it.
08-16-2017 05:06 PM
I'm not seeing any way to programmatically change the channel alias within a saved task. There is a VI called DAQmx Save Global Channel but it appears to move the channel from inside the task to outside the task, converting it to a global channel.
I don't understand why you want to do this. If the channels are already defined within Max in a task, the functionality has already be established by someone. The user just needs to select the task they want to run and click Go.
08-16-2017 05:06 PM - edited 08-16-2017 05:11 PM
@aputman wrote:
Edit: Nope this isn't it.
You forgot to set Active Channel first. Other than that you should be golden.
As To Why... If you are logging to TDMS the channel name is picked up in the file.
08-16-2017 05:08 PM
@JÞB wrote:
@aputman wrote:
Edit: Nope this isn't it.
You forgot to set Active Channel first. Other than that you should be golden.
Nope. I tried that already. PhysicalChanName is the device and channel name (i.e. dev1\ai0), not the alias that the OP is looking for.
08-16-2017 05:15 PM
@aputman wrote:
@JÞB wrote:
@aputman wrote:
Edit: Nope this isn't it.
You forgot to set Active Channel first. Other than that you should be golden.
Nope. I tried that already. PhysicalChanName is the device and channel name (i.e. dev1\ai0), not the alias that the OP is looking for.
Give this a shot
08-16-2017 05:19 PM
I tried that as well. Reading that property of an existing task returned an empty string, not channel alias.
08-16-2017 05:46 PM
It may have something to do with the task being defined before. I use the same construct except without a predefined task in my programs. See below.
It's ugly looking, but it works.
The Eight Ball says "I can't add much to this conversation"
mcduff
08-17-2017 06:57 AM - edited 08-17-2017 07:03 AM
Thank you for the suggestions - I realize it can be done if there is no predefined task, however, the desire is to have a task template with numerous pre-defined signals, but they need to be able to be edited. I do not want to have to require my techs to type in all the parameters for all of the different signals for each and every test when they are all very similar, but do have some differences. A different transducer or calibration, replace a 0-100 PSI pressure transducer with a 0-1000 PSI, or with a 500 pound load cell. It probably will need to be done in an .ini file, but I was trying to avoid that.
08-17-2017 10:21 AM
I tried making minimal changes to the original posted code. I see now that the main idea is essentially similar to what mcduff posted -- use the global task & channel defs to create a brand new task with minimal mods. Then you save it, overwriting the previously defined global task.
I could have sworn there was a thread from Bob_Schorr a couple months or so ago that got into pretty similar territory in greater detail. Can't seem to find it now.
-Kevin P