10-15-2013 10:49 AM
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:
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?
Solved! Go to Solution.
10-15-2013 11:37 AM
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.
10-16-2013 09:21 AM
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?
10-16-2013 09:46 AM - edited 10-16-2013 09:48 AM
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.
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.
10-16-2013 10:38 AM
Thanks for your help,
I have one more request: The aliases tree is not automatically refreshed, is there a way to force the refresh?
06-21-2022 09:12 AM
您好,我用上面那位的第一种方法创建别名,程序显示运行正常,但是我打开*.nivssdf确发现里面并没有我创建的别名,我用的是LabVIEW2018。
另外,第二种方法里的“Refrenced Channel”是什么意思啊?
我按照第二种方法操作,会报错:System.Reflection.AmbiguousMatchException: 发现不明确的匹配