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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -200072 While Editing a Task Progammatically

Solved!
Go to solution

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.

0 Kudos
Message 1 of 22
(3,920 Views)

Capture.PNG

 

Edit: Nope this isn't it.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 22
(3,902 Views)

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. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 22
(3,874 Views)

@aputman wrote:

Capture.PNG

 

Edit: Nope this isn't it.


You forgot to set Active Channel first.  Other than that you should be golden.Smiley Wink

 

As To Why... If you are logging to TDMS the channel name is picked up in the file.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 22
(3,873 Views)

@JÞB wrote:

@aputman wrote:

Capture.PNG

 

Edit: Nope this isn't it.


You forgot to set Active Channel first.  Other than that you should be golden.Smiley Wink


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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 22
(3,869 Views)

@aputman wrote:

@JÞB wrote:

@aputman wrote:

Capture.PNG

 

Edit: Nope this isn't it.


You forgot to set Active Channel first.  Other than that you should be golden.Smiley Wink


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

Capture1.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 22
(3,862 Views)

I tried that as well. Reading that property of an existing task returned an empty string, not channel alias. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 22
(3,858 Views)

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.Snap2.png

 It's ugly looking, but it works.

 

The Eight Ball says "I can't add much to this conversation" Smiley Wink

 

mcduff

 

 

 

Message 8 of 22
(3,847 Views)

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.

0 Kudos
Message 9 of 22
(3,807 Views)

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

 

redefine global task with new channel name.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 10 of 22
(3,793 Views)