annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Event name resolving

Résolu !
Accéder à la solution

Hi,

A device variables are organised in cluster and the device uses event. If application uses multiply devices then Event structure has multiply dynamic event with the same name, like "<Int>:User Event".

Is any way to change Event name?

Example is attached.

 

Thanks, Andrey.

 

0 Compliments
Message 1 sur 11
5 583 Visites

Don't use the same Constant labelled In for both Create User Events.  Use a constant with a different label for the second Create User Event.

Message 2 sur 11
5 576 Visites
Solution
Accepté par Vasilich2004

@RavensFan wrote:

Don't use the same Constant labelled In for both Create User Events.  Use a constant with a different label for the second Create User Event.


OR

 

You can use a type cast and the top input of same can use a different name. The name of the event comes from the wire wired to the create so the type cast will allow using the same data type (example: a type defined cluster) but the type cast will result in events of unique names.

 

But that is only if the simple approach is not an option.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Compliments
Message 3 sur 11
5 569 Visites

Agree. Name comes from variable name which attached to Create event.

What to do in case of multiply the same devices? Please, see attachment.

0 Compliments
Message 4 sur 11
5 567 Visites

You've created a different problem than you first posted because now you are using the cluster to get event Ref rather than the original event Ref.  Is there a reason why you changed it?  So now user event is coming from the Event Ref element which gets its name from the cluster.

 

So do what Ben said and use a typecast on the pink wire to change the name of the Event Ref element in each of the clusters.

 

If you used the original arrangement, the 2nd constant should have been called Int2 instead of keeping the same name "Int" as before.

Message 5 sur 11
5 564 Visites

@Ben wrote:

@RavensFan wrote:

Don't use the same Constant labelled In for both Create User Events.  Use a constant with a different label for the second Create User Event.


OR

 

You can use a type cast and the top input of same can use a different name. The name of the event comes from the wire wired to the create so the type cast will allow using the same data type (example: a type defined cluster) but the type cast will result in events of unique names.

 

But that is only if the simple approach is not an option.

 

Ben


Ben,

That is interesting trick and Typecast do changes name. It can be used directly before "Register For Events" in top vi but I still don't see way to use in Connect.vi (see picture in my previous post).

 

Also will it work when cluster after typecast will be input to

- another vi?

- Start Asynchronous Call Node?

 

P.s. could you, please, look on another problem with Start Asynchronous Call Node and cluster https://forums.ni.com/t5/LabVIEW/Cluster-with-VI-reference/m-p/3878133/highlight/false#M1099247

0 Compliments
Message 6 sur 11
5 550 Visites

@RavensFan wrote:


 

sorry for confusion. just tried to simplify example.

0 Compliments
Message 7 sur 11
5 545 Visites

What is "Connect.vi"?  None of your pictures have a VI by that name.

 

Now you are talking about other VI's.

 

It seems like you are trying to use User Events in an architecture that is far more complicated than you seem to be ready to use.

 

Do you really need multiple user events?  Just create one user event.  Add a string value to the cluster where you can put in an identifier as to which device is generating the event.  Then use that value inside your single User Event Case.

0 Compliments
Message 8 sur 11
5 543 Visites

LabVIEWQuestionV2.png has text "Connect.vi is called first time" and "Connect.vi is called second time". Connect.vi is in circle. I just tried to show multiply Vi on one picture.

0 Compliments
Message 9 sur 11
5 536 Visites

@RavensFan wrote:

Don't use the same Constant labelled In for both Create User Events.  Use a constant with a different label for the second Create User Event.


That is incorrect. In example, name doesn't come from constant "Int" which connected to "Create User Event". Name comes from integer control "Int" of Device cluster.

0 Compliments
Message 10 sur 11
5 534 Visites