Passing a reference to a type definition to a SubVI

I have created a type definition that I would like to use across my application. This particular type definition is also the front panel control to my top level VI. I wanted to pass a reference to this control to my SubVi's so that they could dereference as needed and in very rare cases update the values on the front panel. However, as I built the application I noticed that I was breaking the control reference as I updated the type definition. This implies that they type of the reference changes as I change the type definition.
How do I go about building the reference I need or is there some other way to do this that works just as well. Even if I can't make a reference to the control that is tied to the type definition, I'm willing to pass in a variant who can house the reference as long as I can build the data type (the reference) inside my SubVis.
Solved!
Go to Solution.

Okay, so I tried all three approaches in a SubVI, here's what happened.
My approach was simply to create a Type Def control, right-click and create a Reference. Then create a control from that reference by right-clicking the output of the reference and selecting the Create Control option. I then pasted this 'cluster' reference into my SubVi, made it an input and then wired up the reference in the parent to the control in the SubVi.
Result: This breaks when you update the Type Definition.
Next, Ben's approach (or my best effort at doing what he suggested). I created a control from reference to the type def. I cut it from the parent VI and pasted it into a new type def. I then put the type def in the SubVI and set it as an input.
Result: This breaks when you update the Type Definition (but it actually takes a bit longer for the error to propogate).
Finally, Christian's solution (or my best effort). I took the type def reference and put it through a To More Generic Class guy, casting it to a Control Refnum. I put a Control Refnum on the front panel of my SubVI and wired it to a To More Specific Class guy. I created a control of the type def in the subvi, hid it, and created a reference. I wired the reference to the more specific guy and verified I was getting the right data.
Result: It works!
It's possible I just didn't understand how to make the reference type def you were referring to Ben. I would prefer a method with less verbage. I pass this refnum into a class which holds it. Since I can't replicate the type exactly prior to run time (i.e. create a control that is exactly a reference to the type definition of my front panel), I have to save the reference as a Control Refnum and cast it every time I need it (i.e. create a control from the typedef, create a reference frome the type def, etc). More verbage than optimal, but still good!
Thanks for the help.

Similar Messages

  • Determine if a control reference is a strict type definition

    If a VI is passed a control reference it can determine the VI Server Class using the ClassName property but how can it determine if the control reference is from a control which is based on a strict type definition?

    That a pretty neat little VI you've found, Darren. Kudos!
    The solution that Darren presents, however, will not tell the difference between a typedef and a strict typedef (unless I'm missing something). If you have VI Scripting enabled (see attachment for where to enable this in the Options menu), you can expose the Is Typedef? property. 
    This returns an enum with the following values (as pictured)
    not a typedef
    typedef
    strict typedef
    class private data
    Although this property is not settable in a VI at run-time, it should be readable.
    Below is a picture of the Options menu where you can enable VI scripting
    Mitch
    Attachments:
    VIScripting.PNG ‏33 KB

  • Bind FPGA host reference to type definition in labVIEW 2012 crashes labVIEW

    Hi,
    I am using FPGA target device 5641R and labview FPGA 2012 with 5640R ver 1.7.
    On the configure window of open FPGA VI reference function, choosing the dynmaic mode shows broken arrow when wired to the 5640R configuration VIs (i.e. Configure timebase, Configure ADC default, Configure ADC NCO functions). So i tried the other option which is binding the FPGA host reference to type definition and choose the control from path C:\Program Files\National Instruments\LabVIEW 2012\instr.lib\ni5640R\Configuration\NI-5640R VIs\ni5640R FPGA VI Reference.ctl. But after that when i try to save the VI on which open FPGA VI reference function is placed, labVIEW crashes. I am unable to figure out the reason. Earlier I was working with labVIEW 2011 and it was working fine there. Any suggestions would be highly appretiated. 
    Please see the attached images for more details.
    Thanks
    Attachments:
    1.png ‏33 KB
    2.png ‏71 KB
    3.png ‏40 KB

    Check out this thread.  It looks like someone else ran into a similar issue and made changes that fixed their application.
    http://forums.ni.com/t5/IF-RIO/correct-5640r-template-use-recommendation/td-p/1331918
    Jeff B.
    Applications Engineer
    National Instruments

  • Type definition and reference

    Hello,
    when I look at the "Usage" column in the Types view, am I right to assume that the first location given for a type is where the type is defined, all others where it is referenced?
    Example:
    Name                 Type                           Version    Usage
    OMS_StdQueueInput    Container, Type Definition     0.0.0.4    OMS_Types.ini; OMS_LocalTypes.ini; OMSStart.seq    No comment
    So here I would assume, that the type OMS_StdQueueInput is defined in OMS_Types.ini and used/referenced in OMS_LocalTypes.ini and OMSStart.seq. Is that correct?
    Regards,
    Peter
    Solved!
    Go to Solution.

    By INI file do you mean a TestStand Type Palette File?
    A new feature was added to TestStand (in 4.1 I think so you should have it) that allows you to control when automatic conflict resolution (choosing the highest version of  a type silently) occurs. The setting is located on the File tab of the Station Options dialog and is called "Allow Automatic Type Conflict Resolution". In general, I recommend changing it to the slightly more restrictive setting of "Only If a Type Palette File has the Higher Version" because this will get rid of the possibility of automatic conflict resolution when opening two sequence files with different versions of a type when the type does not exist in a type palette file. But if your type will always be in a type palette file then the default setting is fine.
    First, some background information.
    Automatic Type Conflict Resolution - This occurs when a file is opened whose type is different from the version already loaded into memory, and the criteria for automatic resolution is met (i.e. the station option setting allows it, neither verison of the type is marked as modified, and the different versions of the type have different version numbers). When automatic resolution occurs TestStand automatically chooses the version of the type with the highest version number.
    Let me know if you want me to explain other terms.
    What I'd recommend for type management:
    1) Create a type palette file for your standard types. Make sure all deployed and development systems are using/loading this type palette file. If you need more details on how to do this please let us know.
    2) Control updates to these types using a source code control system to control updating of the type palette file(s). Ideally, only one person should be editing a type palette file at a time. Source code control systems can be used to enforce this.
    3) Let your developers know that they should only edit types in the type palette files and not in individual sequence files.
    4) Try to make all changes to your types and substep code backwards compatible so that old sequences will continue to work with newer versions of the types. If you have to break backwards compatibility, consider creating a new type instead and use the new type from now on, but leave the old type there for backwards compatibility (you can use flags to hide the old version of the types from the insert menu if needed).
    If you use a type palette file in this way I think you will get something close to what you are asking for. With the default setting for "Allow Automatic Type Conflict Resolution", if all of your TestStand systems are loading your standard type palette files then you will either get the version in the type palette file or your will get a type conflict dialog if the version in the sequence file is newer. There will be no possibility of silently using a version other than the one in the type palette file. Is this sufficient for your needs or are you looking for something different. If you are looking for something different please let us know the specific behavior you require.
    Hope this helps,
    -Doug

  • Control Value:Set [Variant] Method - how can i use this with strict type definitions?

    I want to pass default values to a strict type definition from a mainVI to a subVI, but I'm not allowed to use the "Control Valueet [Variant] Method" invoke node to do it.  How else can I achieve this?
    thanks,
    Z

    Hi Z,
    If you use strict type defintion references you can use Call by reference Node. Depending on the connector pane for the subvi which is referenced you just wire your data to the corresponding terminals. I attach an easy example which dynamically opens and writes to an arbitary number of a template.
    Hope it helps
    Pelle S
    District Sales Manager
    National Instruments Sweden
    Attachments:
    Call by reference node.zip ‏20 KB

  • Delay when applying large, hierarchical type definitions

    Hello,
    I searched around using various terms, but couldn't readily find posts on what I'm experiencing.
    Has anyone else noticed huge delays when applying large, hierarchical type definitions?  I've got about a dozen nested type definitions of clusters, each containing anywhere from 10 to 100 controls, and they're used throughout a large application.  When I open any member of that hierarchy, make a small change, and hit apply, I see the hourglass (spinning ring of death in Vista/7) for a good two to five minutes.
    A short term workaround has been to close all dependent VIs and typedefs, and then make an isolated edit.  Then, if I open the whole application again, I see some compiling taking place, but it seems to take a lot less time than when the whole application is open.
    I could have sworn that I read a discussion by some others commiserating about this at some point, but now I can't find it.
    Has this been addressed, and has anyone heard if there's any development effort to improve this?
    Thanks,
    Jim

    Hi Fred,
    Thanks for getting back to me on this.
    > You could use more specific typedefs and not a massive one to pass data through VIs.
    It's funny, I've actually adopted using larger typdefs in the last year or two for architectural simplicity, and that's when I've noticed this becoming a problem. In fact, for what it's worth, right now I'm using a data reference to store the "data dictionary" (large typedef) but that doesn't really help the issue.
    From an architectural sense, it makes things easier for me because I have much fewer wires to pass around most of my data is in one place.
    > Or you could pass a queue reference to the subVIs and have the queue be made of of elements that are the large type definition.
    Actually, I'm using a data reference right now, which is somewhat analogous to what you're suggesting. (Maybe not? I also use queues and notifiers depending on the situation.) I haven't really seen this technique help the issue; I'm still noticing the large delays, but only when editing the typedefs.
    The only way I've really found relief is to separate the large typedef into smaller ones and pass them around separately. This is kind of a pain because it means I have many more references to data structures to keep track of.
    > If this is causing major problems, let me know, and I'll pass along your concerns to R&D.
    Actually, if I'm to be honest, it really is starting to become a hassle. I hit apply and end up working on something else for a few minutes while the compiler chugs away. I'd be really interested in an improvement in this area. If it makes things easier, I can discuss this via email and upload an application I'm working on as an example. (Multiple large apps I'm working on exhibit this behavior)
    Thanks again for your help.
    Regards,
    Jim

  • Confused about passing by reference and passing by valule

    Hi,
    I am confuse about passing by reference and passing by value. I though objects are always passed by reference. But I find out that its true for java.sql.PreparedStatement but not for java.lang.String. How come when both are objects?
    Thanks

    Hi,
    I am confuse about passing by reference and passing
    by value. I though objects are always passed by
    reference. But I find out that its true for
    java.sql.PreparedStatement but not for
    java.lang.String. How come when both are objects?
    ThanksPass by value implies that the actual parameter is copied and that copy is used as the formal parameter (that is, the method is operating on a copy of what was passed in)
    Pass by reference means that the actual parameter is the formal parameter (that is, the method is operating on the thing which is passed in).
    In Java, you never, ever deal with objects - only references to objects. And Java always, always makes a copy of the actual parameter and uses that as the formal parameter, so Java is always, always pass by value using the standard definition of the term. However, since manipulating an object's state via any reference that refers to that object produces the same effect, changes to the object's state via the copied reference are visible to the calling code, which is what leads some folk to think of java as passing objects by reference, even though a) java doesn't pass objects at all and b) java doesn't do pass by reference. It passes object references by value.
    I've no idea what you're talking about wrt PreparedStatement, but String is immutable, so you can't change its state at all, so maybe that's what's tripping you up?
    Good Luck
    Lee
    PS: I will venture a guess that this is the 3rd reply. Let's see...
    Ok, second. Close enough.
    Yeah, good on yer mlk, At least I beat Jos.
    Message was edited by:
    tsith

  • JAXB compiler error : Complex Type Definition Representation Error

    Hi,
    I have a problem when I try to generate Java classes for the XML Digital Signature schema along with the XAdES extension. Apparently, we got an XML validation issue when the XAdES schema is parsed.
    Here is the xjc tool ouput :
    [ERROR] src-ct.1: Complex Type Definition Representation Error for type 'IdentifierType'.  When complexContent is used, the base type must be a complexType.
      line 33 of XAdES.xsd
    [ERROR] src-ct.1: Complex Type Definition Representation Error for type 'EncapsulatedPKIDataType'.  When complexContent is used, the base type must be a complexType.
      line 57 of XAdES.xsdNow these are the schema lines from XAdES.xsd that cause the problem :
    <xsd:complexType name="IdentifierType">
      <xsd:complexContent>
        <xsd:extension base="xsd:anyURI">
          <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>
    <xsd:complexType name="EncapsulatedPKIDataType">
      <xsd:complexContent>
        <xsd:extension base="xsd:base64Binary">
          <xsd:attribute name="Id" type="xsd:ID" use="optional"/>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>The most disturbing thing is that those two schemas I used (e.g. xmldsig-core-schema.xsd and XAdES.xsd) come directly from the W3C, so they should be fully compliant to the XML schema spec, shouldn't they ?
    Moreover, I tried to validate these two schemas with XML Spy 4.3 and the problem occurs in slightly different way. In fact, the <xsd:complexContent> tags are replaced silently by XML Spy with <xsd:simpleContent> tags in order to validate the schema. So XML Spy seems to have a problem too with these complex type definitions. Besides, if I replace the <xsd:complexContent> tags the same way as XML Spy does, and if I run again the JAXB compiler, it works fine...
    Does anyone have any knowledge about this issue ? I'd like very much to hear about anyone who has experienced or better solved the same kind of issue.
    By the way, here is the version of JAXB that I use :
    xjc version "1.0.2-b15-fcs"
    JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build 1.0.2-b15-fcs)Any help appreciated.
    Thanks,
    Gregory

    <xsd:extension base="xsd:anyURI">
    <xsd:extension base="xsd:base64Binary">
    The base attribute of the xs:extension elements shoule refer to a complexType.
    For example,
    <xs:complexType name="complexTypeA">
    </xs:complexType>
    <xsd:complexType name="IdentifierType">
    <xsd:complexContent>
    <xsd:extension base="complexTypeA">
    <xsd:attribute name="Qualifier" type="QualifierType" use="optional"/>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>

  • How to pass file reference to c

    Hi,
    I want to pass file reference pointer to a dll written in visual c++. How can i do that?

    What do you want to do with that reference in your C code? if you want to access it using OS File IO functions you have to be very careful! You should not mix LabVIEW nodes and OS platforms calls together. It's either one or the other.
    If you can guarantee that what you want to do is configure the Call Library Node (CLN) parameter to Adapt To Type. Then right click on the CLN and select "Create C Source Header" or something to that meaning. Save the resulting file to disk. Open it and copy the function prototype into your C/C++ file. There should be a parameter typed LVRefnum *. Now you can use the LabVIEW manager C function MgErr FRefNumToFD(LVRefNum refNum, File *fdp);
    You need to link your DLL with labview.lib in the cintools directory in order to be able to call the FRefNumToFD() function. The value in the fdp reference is the platform specific file handle, so for Windows this is a HANDLE.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • What is the use of passing object reference to itself ?

    What is the use of passing object reference to itself ?
    regards,
    namanc

    There is an use for returning an object reference from itself, for instance:
    class C {
    public:
         C append(C c) {
             // do something interesting here, and then:
             return this;
    }You can "chain" calls, like this:
    C c = new C();
    C d = new C();
    C e = new C();
    c.append (d).append (e);Maybe the OP has "inverted" the common usage, or thought about a static method of a class C that requires a parameter of type C (effectively being a sort of "non-static method").
    class C {
        static void doAnotherThing (C c) {
            c.doSomething(); //-- effectively C.doAnotherThing(c) is an "alternative syntax" for c.doSomething()

  • Pass by Reference automatically?

    In Java, are objects passed by reference automatically?
    Basically, if I pass an object into a method and the method modifies the object, will the original object reflect that modification?

    They're not objects. They're primitive data types. Objects require you to use new when you create and instance of them. Primitives are automatically allocated space when you declare them. Also, they are not passed by reference... only a copy of them is passed on the methods

  • Error Master Type definition could not be found : FPGA

    I am having similar/exact error condition as in the below post..
    http://forums.ni.com/t5/LabVIEW/Error-Master-Copy-for-Type-Definition-Could-Not-Be-Found/m-p/1496866...
    The *.lvbit file i am using was compiled in Labview 8.2.1 and I am now using 2009 version of Labview.  Unlike the suggested solution, recompilation of *.lvbit file is ruled out due to lack of source code access.
    Any help towards troubleshooting is appreciated...

    Because I am a bad scientist, I do not know exactly what fixed my problem because I changed more than one variable at once.
    Here's what I did:
    Removed auto-populating folder from project (doubt this mattered, still broken after this)
    Changed my open FPGA VI reference from using a bitfile to using a VI, selected my FPGA VI, NO MORE BROKEN RUN ARROW! YAY.
    The above finding led me to go look at my FPGA bitfiles on disk -- I had two of them (weird). Usually a compilation just overwrites the older file.
    Just in case the names give any insight, they are:
    Older:  NASATTRControlCo_FPGATarget_FPGAMain_25B3817B.lvbitx
    Newer: NASATTRControlCo_FPGATarget_FPGAMain_25AF817B.lvbitx
    I went back to my open FPGA VI reference, and selected the most recent bitfile that I compile this morning -- No more broken run arrow.
    I have a feeling this may be due to selecting an old bitfile, but usually if the bitfile doesn't include the control, it won't show up in the read/write control node. If anyone from NI would like to comment on this I'd appreciate the insight on what may have happened.
    I am wondering if it's because I installed 2010 SP 1? Who knows but it's fixed now.
    CLA, LabVIEW Versions 2010-2013

  • Subroutine Pass by Value, Pass by Reference using xstring

    Hi,
      I am trying to check the difference between pass by value, pass by reference, pass by return value to a subroutine. When I tried integers as parameters the following functionality worked. When I am using xstring as parameters I am not getting desired results.
      Some one please explain me how the xstring's are passed to a subroutine.
    Here I am giving the code and output of the code.
    data : s_passbyref    type xstring,
           s_passbyval    type xstring,
           s_passbyretval type xstring.
    * Pass by Value, Pass by Reference, Pass by return value - STRINGS
    s_passbyref     = 'ABCD'.
    s_passbyval     = 'ABCD'.
    s_passbyretval  = 'ABCD'.
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.
    perform call_str_sub using s_passbyref s_passbyval changing s_passbyretval.
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.
    form call_str_sub using ps_passbyref value(ps_passbyval) changing value(ps_passbyretval).
      ps_passbyretval = 'XYZ'.
      ps_passbyref    = 'XYZ'.
      ps_passbyval    = 'XYZ'.
    endform.
    OUTPUT
    ByRef  :  ABCD    By Val : ABCD    By Return Value : ABCD
    ByRef  :               By Val : ABCD    By Return Value :
    Thanks in advance
    Naveen

    try this
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', ps_passbyretval.

  • ExternalInterface: pass object reference across interface - how?

    I want to invoke methods on specific Javascript or
    ActionScript objects through calls across the ExternalInterface
    barrier. I would like to be able to do this either AS -> JS or
    JS -> AS.
    So I would like to pass an object reference across the
    interface. I'm not sure exactly what *is* getting passed (is it the
    serialized value of the object?), but it doesn't seem to work as an
    object reference.
    Here's a notional code sample. I have two symmetric object
    definitions, one in Javascript, one in ActionScript. During
    initialization, one instance of each object will be created and
    given a pointer to the other. Then they should each be able to
    invoke a method on the other to "do stuff".
    //----------[ code ]---------------------------------
    //--- Javascript ---
    class JSobj {
    var _asObj;
    JSobj.prototype.setASObj = function(obj) { _asObj = obj; }
    JSobj.prototype.callASObj = function(foo) {
    callASObjectMethod(_asObj, foo); } // does: _asObj.asMethod(foo);
    JSobj.prototype.jsMethod = function(bar) { /* do stuff */ }
    function callJSObjectMethod(obj, args) { obj.jsMethod(args);
    //--- ActionScript ---
    class ASobj {
    var _jsObj;
    public function set jsObj (obj:Object):void { _jsObj = obj;
    public function callJSObj (foo:Number):void {
    ExternalInterface.call("callJSObjectMethod", _jsObj, foo); } //
    does: _jsObj.jsMethod(foo);
    public function asMethod (bar:Number):void { /* do stuff */
    function callASObjectMethod (obj:Object, args) {
    obj.asMethod(args); }
    ExternalInterface.addCallback("callASObjectMethod",
    callASObjectMethod);
    //----------[ /code ]---------------------------------
    My workaround is to pass a uint as an opaque handle for the
    object, then resolve it when it is passed back. I'd rather pass a
    real reference if possible. Is there a way to pass object
    references between JS and AS?
    Thanks,
    -e-

    It's an object of a class that extends Object. I guess the answer is no then.
    Thanks for your answer

  • [Applicati​on Builder] What does "disconnec​t type definition​s" accomplish​?

    Hi all,
    Inside the Build Specification properties, there's an option "Additional Exclusions" -> "Disconnect type definitions".
    The only piece of documentation I've found is at http://zone.ni.com/reference/en-XX/help/371361H-01​/lvdialog/additional_exclusions_sd/ but it's not very descriptive. It suggests that disconnecting might cause front panel objects to be displayed incorrectly. Is this the case?
    What does this option do? Its existence suggests to me that type definition info persists inside a compiled LabVIEW application, unless we choose to disconnect them.
    When should I disconnect, and when should I leave type definitions alone?
    Thanks in advance!

    I only know one use case for this option: when application builder throws errors during builds or exe itself doesnt work.
    One reason to use it is when you use Network Shared Variables with typedefs - I recall problems with shared variables not founding theirs typedefs after build. This option also happens to fix more exotic problems - see LV2014 bug fixes: 
    426523
    A specific large project fails to build with a GenIL error and then crashes if you do not select Disconnect Type Defs
    So, other than to workaround app builder problems - I don't know any other reason to mark Disconnect Type Definitions.

Maybe you are looking for

  • How to change a h:outputText value in the current form on key pressed event

    Hello Suners, Greetings! I'm developing my first JSF web application and i'm trying to figure a way out to change outputText value when key pressed on another inputText so that when the user is typing his name for example he can see the letters showi

  • Gallery Prob on N91

    Hey everybody, I have been using this fone since july 7,06.faced a little hanging on running applications (thats nothin at all),did not face any sms sending either, but the problem is: When my gallery is full with 300-350 hi-rez wallpapers with 12-13

  • HTML window in Flash

    Hi there, I have created an animation (.swf) with a third party software application. I tried to import it as a symbol into Flash but it is constructed in such a way that it won't work. It requires to be housed within an html environment in order to

  • Splitting a Partition into smaller Volumes

    Hi, On an external drive I have 3 partitions. One of these is an empty 250gb partition. I'd like to split that into smaller 15gb sized partitions for some multiple install testing. In disk utility I have selected the partition and clicked the + sign

  • ICloud parola defecta sau id-ul

    Buna ziua am si eu o problema cu id-ul de iCloud atunci cand încerc sa i-l activez îmi spune ca parola este gresita insa aici apare problema deoarece id-ul de iTunes este unul si cel de iCloud îmi apare altul si nu i-l pot schimba dar la baza sunt un