Jump to content
Dustin

Problem reading clusters names in empty array of clusters

Recommended Posts

I've run into an interesting problem using the Open G variant library.  When trying to extract a list of cluster element names from a cluster in an empty array of clusters in a cluster itself, I get the following error from the Open G "Get Cluster Element Names VI":

 

 

Error 1 occurred at (Unexpected Datatype <<Null>>) Split Cluster TD__ogtk.vi in Get Cluster Elements TDs__ogtk.vi->Get Cluster Element Names__ogtk.vi->empty array of clusters problem.vi

 

An example VI showing the problem is attached.

 

At first I thought the problem was due to the fact the array is empty, but asking for cluster names of an empty array of clusters that is not in a larger cluster completes without error.

 

Any thoughts on the cause or solution to this problem?

 


post-51778-0-27433000-1398893285.png

Share this post


Link to post
Share on other sites

I've never used the OpenG Variant tools, but when I try to perform the comparable operation with the VariantDataType VIs (vi.libUtilityVariantDataType), it works fine.

post-4441-0-30970700-1398897555_thumb.pn

Share this post


Link to post
Share on other sites

Darren, thanks for pointing out these VIs!  It appears that the problem with the OpenG VIs is in the "Array to Array of VData" conversion, this VI is attempting to convert an array contained in a single variant to an array of variants.  The method used, a NI "Variant to Data" VI without the type input wired doesn't seem to work when the array of clusters is empty.  Although, I'm not sure how I would do it any differently.  It would seem that this should be made into a bug report, if one doesn't already exist.

 

post-51778-0-06362800-1398977310.png

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By Andersen Chen
      hello everybody,
      i want to index column 0~39,how to achieve and simplify
      thank you for help
      array.vi
    • By Taylorh140
      So sometimes when you do protocol decoding it is convenient to use a variant to store decoded data. For example you might have a 2 bit enumeration that is decoded like this:
      00 -> Good
      01 -> Bad
      10 -> Ugly
      11 -> Catastrophic
      If you cast the value to an enumeration that contains these values before hand you can see them on the variant control. If you use a Ring you will only see a value. 
      I know that the LV flatten to string contains the enumeration strings but the encoding is a bit of a mystery, although it looks like the openg palette has figured some of it out to some degree. But to me it doesn't look like there is any reason i couldn't generate an enum to use inside the scope of a variant. Has anyone done this, or know how to generate the string for this purpose. 

    • By Fred chen
      Hi
       
      When I call the DLL, there is a structure:
      struct Signal { uint32 nStartBit; uint32 nLen; double nFactor; double nOffset; double nMin; double nMax; double nValue; uint64 nRawValue; bool is_signed; char unit[11]; char strName[66]; char strComment[201]; };  
       
      There is another  Message structure to the above Signal:
       
      struct Message { uint32 nSignalCount; uint32 nID; uint8 nExtend; uint32 nSize; Signal vSignals[513]; char strName[66]; char strComment[201]; }  
        The point is  Signal vSignals[513];
       
      I've tried to solve it like this,but the program will crash.
       
      How to create struct Message ,any good suggestions?  Thanks a lot.
       

      message.vi
    • By Taylorh140
      After working on the set cluster element by name xnode, it made me realize i could use the same concept to convert a variant array to a cluster. The technique is actually pretty simple, the xnode generates a case structure for each element in a cluster in cluster order, wherein a bundle by name is used to set the value and an unbundle by name is used to get the type, a variant to data is used to convert the data. This has some benefits over some methods, you are not limited to 255 elements, although that is not usually the case some of us are paranoid that clusterosaurus giganticous will be larger than expected. It also has a draw back  that is that when converting from a variant array all the elements must have unique, non-blank names, and this is usually the case. 

      I think this technique (though very brute-force) might be useful for some other things let me know what you guys think.

      VariantArrayToCluster.zip
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.