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.
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.
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?
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.
Thanks for your help,
I have one more request: The aliases tree is not automatically refreshed, is there a way to force the refresh?