Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Rename Networkvariable

Hey,

 

i'm trying to start using Measurement Studio, but can't remember where i could rename the Network-Variables.

As you can see i began renaming some in the past, but i can't figure out where i could do this again to have more consistency.

 

Thanks for your help

0 Kudos
Message 1 of 2
(5,091 Views)

There's no one-step process to rename a variable. It can be achieved by making a new variable with the same configuration but a different name. For example, this will have the same effect as renaming a variable:

private void RenameVariable(ServerVariableInfo variable, string newName)
{
    var newOptions = new VariableCreationOptions(variable.Process.Name, newName);
    newOptions.Description = variable.Description;
    newOptions.ItemCapacity = variable.ItemCapacity;
    newOptions.SingleWriter = variable.SingleWriter;
    newOptions.VariableType = variable.VariableType;

    variable.Process.CreateVariable(newOptions);
    variable.Delete();
}

Unfortunately, if the variable was one of the more exotic kinds of network variable item and had properties that aren't exposed by the ServerVariableInfo class, this won't carry those properties over to the new item.

Owen P.
Software Engineer
National Instruments
0 Kudos
Message 2 of 2
(5,070 Views)