VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

create an alias from a custom device page

Solved!
Go to solution

Is there a way to create an alias from a custom device page?

 

I would like that a button on the main page of my custom device (in the system explorer) allow the user creating an alias and linking this alias to a channel of the system. My Vi is the following:

 

AddAlias.jpg

 

 

This VI returns the following error:

"Error 1172 occurred at Error creating instance of Alias in assembly NationalInstruments.VeriStand.SystemDefinitionAPI.Alias, NationalInstruments.VeriStand.SystemDefinitionAPI, Version=2012.0.1.0, Culture=neutral, PublicKeyToken=a6d690c380daa308, (System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.)"

 

Is there a solution?

0 Kudos
Message 1 of 6
(7,355 Views)

There is a known issue (CAR 398626) in VeriStand 2012 with the Alias constructor you are using that causes it to throw an exception, which is the error 1172 you are seeing. This issue is fixed in VeriStand 2013.

 

For VeriStand 2012, you can work around this by using an alternate Alias constructor as seen below, which takes in a Channel reference instead of a path.

 

Alias_Workaround.png

Jarrod S.
National Instruments
0 Kudos
Message 2 of 6
(7,349 Views)

Hey Jarrod,

 

Thanks for your response.

Your code works if I want to create an alias for a system channel but it doesn't work in my case because I want to create an alias for a custom device channel.

Typecast the node of the custom device channel to a channel doesn't work.

Is there a solution?

 

Does LabVIEW 2012 custom device are compatible with Veristand 2013?

0 Kudos
Message 3 of 6
(7,328 Views)
Solution
Accepted by topic author DMous

Hmmm... good point. You can modify my original workaround to set up the alias using the underlying System Storage base node type. This should work regardless of the type of channel. As to your second question, Custom Devices written for 2012 will need to be recompiled in LabVIEW 2013 with VeriStand 2013 support installed. You don't have to modify your code, but you do have to recompile the LLBs.

 

Alias_Workaround2.png

 

In this workaround you start off by creating an alias that links to nothing. Then you update the alias to set the DependentNode property that links it to the channel. You shouldn't have to do it this way, but this will work around the original bug.

Jarrod S.
National Instruments
0 Kudos
Message 4 of 6
(7,322 Views)

Thanks for your help,

 

I have one more request: The aliases tree is not automatically refreshed, is there a way to force the refresh?

0 Kudos
Message 5 of 6
(7,313 Views)

您好,我用上面那位的第一种方法创建别名,程序显示运行正常,但是我打开*.nivssdf确发现里面并没有我创建的别名,我用的是LabVIEW2018。

另外,第二种方法里的“Refrenced Channel”是什么意思啊?

我按照第二种方法操作,会报错:System.Reflection.AmbiguousMatchException: 发现不明确的匹配

0 Kudos
Message 6 of 6
(2,341 Views)