02-28-2013 08:27 AM
Hi,
A colleague and I have been looking into using the function CNVGetVariables().
We couldn't get the function to work as we believed it should work (according to the CVI help files).
I then managed to get it to work in a fashion having seen a post on this forum suggesting it worked solely for variables on the host system (see post http://forums.ni.com/t5/LabWindows-CVI/NetworkVariablePopup-only-shows-running-processes/td-p/115864...)
However, I was using CVI 2010 and my colleague was using CVI 2012. The help in CVI 2010 suggests that CNVGetVariables() refers to processes on the host machine only, and forbids the use of process names containing '\' characters - however, the help in CVI 2012 suggests that it is possible to specify processes on other machines and explains how to use '\' characters with escape sequences - this is the functionality that we can't get to work in CVI 2012.
For instance, my local machine reports having a process 'weather data' which has several example network variables associated with it.
CNVGetVariables("weather data", &MyVariableList, &iNumVars); works correctly, but
CNVGetVariables("\\\\localhost\\weather data, &MyVariableList, &iNumVars); returns with result -6393 "Argument is invalid"
I think the help is rather opaque in specifying how URLs should be stated, but it may seem to suggest that because I am using '\' characters, then I should use:
CNVGetVariables("\\\\localhost\\'weather data', &MyVariableList, &iNumVars); but this too returns with -6393 "Argument is invalid"
What am I doing wrong?
Thanks
Chris
Solved! Go to Solution.
03-07-2013 05:24 AM
Hi Crispie,
Could you just check the formatting of
CNVGetVariables("\\\\localhost\\weather data, &MyVariableList, &iNumVars);
I do not believe 4 "\" are needed. You also require " ' " either side of the process name. If you keep to the formatting laid out in CVI help what do you get?
The help file gives this - \\localhost\\'process''Name'\'variable.Name'.
03-07-2013 08:13 AM
Hi Nathan,
I have tried without the four backslashes, and get the same error. In this instance, I suspect the help file of being wrong, as in other functions using network variables, four backslashes are required, for instance with the function CNVCreateSubscriber().
The formatting stated in the help file is for specifying a process variable, and not an actual process, and whilst I think that I've understood what it is implying I can't get it to work.
The formatting stated in the help file is also inconsistent; the help file reads:
For example, to specify \\localhost\process'Name\variable.Name as a URL, enter the following:
The resulting URL is \\localhost\\'process''Name'\'variable.Name'.
Note that the double backslash is represented as a double backslash in the 'resulting URL', but so is the single backslash. I have tried many variants without success, and just want to know what will work.
Thanks
Chris
03-07-2013 09:58 AM - edited 03-07-2013 09:59 AM
The Network Variable Configuration functions like CNVGetVariables only work for network variable processes and variables on the local machine. Also, these functions do not expect or support passing a machine name in the 'Parent Path' parameters - if you pass a machine name here, the function should return an error. I see the following in the help for the Parent Path parameter of the CNVGetVariables function:
The network variable path. You can specify a process name or a process name
followed by one or more folder names delimited with the backslash path
separator. Do not include a trailing backslash in the path.
So, the correct argument to pass for this parameter in your case is "weather data". Note again that you cannot get the variables from network variables process running on remote machines.
03-07-2013 02:59 PM
Obtains the names of the variables in the network variable process you specify
In CVI 2012, the helpfile for the same function now states:
Obtains the names of the variables in the network variable path you specify.
Why would this have changed, if not to imply that the function has been upgraded to interrogate any Network Variable server that the machine can connect to?
Even if it can only get variable names on the local machine, why does the documentation not clearly state that?
03-08-2013 02:35 AM
Hi Mohan,
As I notice has been pointed out - the help text you quote is from CVI 2010, and in CVI2012, it reads differently, which I take to mean that the functionality has been upgraded, which I believe is the point of the whole query - if the help file has changed then why, and if was because new functionality has been added, then how do we use it correctly?
Cheers
Chris
03-08-2013 08:54 AM - edited 03-08-2013 09:04 AM
The reason the documentation states "path" in 2012 versus "process" in 2010 is because in 2012 this function also supports Network Variable folders - not remote machines. Before 2012, callers can only get the variables directly under a process and cannot get the variables under a network variable folder or sub-folder.
And, by the way, I did quote the help from 2012.
03-08-2013 09:53 AM
Mohan,
You are right - sorry about that - the 2010 help mentions explicitly that backslashes may not be used as part of the process name, and I assumed you were quoting that part.
Thanks also for explaining about the folders.
I would still suggest that the example quoted in the help file of how to specify a path implies that machine names/ip addresses can be specified.
For example, to specify \\localhost\process'Name\variable.Name as a URL, enter the following:
The resulting URL is \\localhost\\'process''Name'\'variable.Name'.
This rule does not apply to computer names.
Thanks again,
Chris
03-11-2013 09:49 AM
Ah, I understand. I wrote bug ID 396521 to fix the example path in the documentation.
03-11-2013 11:25 AM
OK - thanks.