How can I check an object is an instance of any type within an array of related types?

In LabVIEW, it's possible to check the runtime type of an object using To More Specific Class.vi. One usage of this would be to perform a safety check if some kind of class uses instances of another kind of class but is only able to handle a subset of that class' child types.
For instance, let's say you had Beverage.lvclass, which represents an abstract type of product, and several subclasses: Coffee.lvclass, Tea.lvclass and Soda.lvclass.
We also have a Person.lvclass which can drink beverages. A person also has preferences about the drinks they do or do not like:
Attached is an implementation of this in LabVIEW.
In Person.lvclass : Drink.vi, I have the following code. For whatever reason the wire appears broken in these snippets but it's all fine in the actual code.
In Scenario.vi, I have the following code:
What I'm finding is that no error is generated and instead I get "Yum, I love tea!", "Yum, I love coffee!" and "Yum, I love soda!". My guess is that To More Specific Class.vi casts to the static type of the "target class" input wire rather than its runtime type - and because I'm passing in elements from an array of types, the wire's static type is upcasted to the most specific type that is a superclass of the types in the array - which would be Beverage.lvclass. And so the cast is trying to determine if an object of static type Beverage.lvclass is an instance of Beverage.lvclass, which will of course be the case all the time.
Is there any way to make LabVIEW check against the most specific runtype type of an object? As in, is there something I could do that, in this example case, would allow me to get the required behaviour of Joe throwing an error when he's made to drink soda? Or is this another limitation of LabVIEW that I'm going to have to live with?
Solved!
Go to Solution.
Attachments:
TypeCastingExample.zip ‏64 KB

tst wrote:
Your guess seems reasonable. I can't check right now, but there's a primitive called preserve run time type, which should do what you want.
Cheers, that seems to have got it! I've never really looked at Preserve Run-Time Class before, but it seems to do the right thing.

Similar Messages

  • How can i check transported objects.

    Hi Sir/Madum,
            I have transported the objects from Development to Quality server. How can i check whether all Objects came to Quality Server.
    Thanks,
    Vishali Raghava Raju.

    Hi Vishali,
    Go to the Quality server, try SE01 and there you can check in Transport Tab.
    Also you can check in STMS and there you see whether it has gone through successfully.
    Try this document too
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50b1d20e-c1e8-2c10-d9b9-d48eb3a83d89?QuickLink=index&overridelayout=true
    Regards
    Sunny

  • How can I check if an user has access to an url within my web app?

    Hi,
    I have a web application where I allow the users to set their startup page by presenting them a list of startup pages. However, some startup pages can accessed only by certain users, so I want to present the user only those pages the user has access to.
    How can I do this with weblogic?
    One way is to read the web.xml file and determine the roles that have access to the page, then check whether the user has any of those roles.
    Is there a better way eventually using some weblogic api?
    Thanks

    Just for the record, I decided to parse the web.xml file and to simulate whatever the container does.

  • How can I check the serial number in WM?

    Dear Experts
    I have a question: how can I check the serial number in WM? Like I want to know which storage type a serial number exist in. Is there a report can show this information? Currently I only can check the serial number at storage location level.
    Please help. If there is no such a report, which table can I use for develpment?
    Thanks a lot!
    Tony

    Hi Tony,
    Unfortunatelly, you cannot manage serial numbers in bins with ERP WM. For this, you need to have a look to the new warehousing solution from SAP, I mean EWM (extended warehouse management) in SCM. There you can manage an see serial numbers in bins.
    Rgds,
    Philippe

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • Can we check the Objects modifiable " option for standard objects

    Dear Friends
                 In IR , we have imported SRM SERVER->SRM SERVER5.5
    Then we  have checked the option<u><b> "Objects are modifiable"</b></u> then we imported the IDOC from R/3 system under SRM SERVER 5.5 swcv.
    Then created the mapping.It is working fime.
    how ever i am not sure whether it is right process.Can we check the "Objects are modifiable" for standard compoents delivered by SAP????
    Regards
    chandra

    Hi Jai,
      <i> >>>Can we check the "Objects are modifiable" for standard compoents delivered by SAP????
    No. As best practise you are not supposed to do so.</i>
    In order to implement any changes in the mapping we can do it rite.
    Because recently i have applied one SAP note to my SRM swcv and one of the MM object was changed according to the requirements.
    Thanks,
    Prasanthi.

  • How can I check whether DIAdem a 32 or 64 bit version?

    Hi all,
    How can I check in a script whether DIAdem a 32 or 64 bit version? Is there any variable or function?
    I need this tcheck to avoid loading 32-Bit COM objects.
    Thanks
    gemu

    Hi gemu,
    The variable you are looking for is APPLICATIONBITNESS. The variable is available in DIAdem 2014 but without documentation. This documentation will be available in DIAdem 2015. The variable is read only and returns a integer (32 or 64)
    Hope that helps
    Winfried

  • How can i check the selection profile

    Hi Friends,
    In BS42 have assigned selection  status profile to status profile and few status are assigned to status profile(CRTD, APRV and REL)
    In BS42 i can assign one type of status profile(say XXX) to more than on type of selection profiles(say AAA;BBB;CCC).
    Now I am creating a appropriation request (AR). Now have approved AR. and if I check in AR-->Control data tab and clicking on display status overview i m getting here asystem and user status overview and after scrolling down I can see the status profile.
    Now in AR how can I check that which type of selection status  profile it is choosing though I am able to see the status profile.
    Any pointers
    Regards
    Ashutosh

    status selection profile is used to restrcit the selection of objects from the database
    if you AR with REL and the status selection profile allows REL then this AR will be se;ected and displayed in the report.
    You cannot see the status selection profile in any tabs on the object as you can see the system ans user status

  • How can i check the right list

    Hello, dear helpers,
    If the User has opend session.FindById("wnd[0]/usr/cntlCC_REP_****/shellcont/shell/shellcont[1]/shell") - This is the wrong list.
    and  the User has marked lines in the wrong list there is an error in this Code
    selrows = session.FindById("wnd[0]/usr/cntlCC_REP_****/shellcont/shell/shellcont[0]/shell").selectedRows
    error:"The control could not be found by id."
    How can i check the right list?
    look at shellcont[0]  / shellcont[1] in the code
    One solution is with "On Error Resume Next"
    but i looking for a direck Check, similar as
    myfindbyid= session.getFindbyIdName
    Regards,
    Emil

    Hello Emil,
    look here: http://scn.sap.com/docs/DOC-49101
    This solution describes how to check the existence of an object. On the one hand you can avoid the error message "control can not be found" and on the other hand you can check the using of the correct control.
    Hope it helps. Let us know.
    Cheers
    Stefan

  • IP Job in BW finished, but how can I check the IDoc receive status in BW ?

    Hi,experts
    After I execute a Infopackage with loading more than 200000 records data, the infopackage monitor show me yellow light, 186020 from 200000 records. this infomation still show me till now, seaval hours,it looks pause here.
    And I check the request in the R/3, the Job has finished. as you know it means the R/3 push the IDoc already finished.
    and how can I do now ? or how can I check the IDoc receive status in BW side?

    Hi,
    I too had the same problem, i executed the following to solve the proble, may be this will help you:
    1) Go to T-code SM58 and select TRFC and press F6,
    2) For manual push of I-Docs, GO to T-COde BD87 select perticular idoc and see the status if it is not executed properly then do the manual push by pressing Execute option,
    Thanks,

  • Control-k key binding broken. How can I check and change my key bindings?

    I use the Terminal app a lot. Unfortunately I am not able to use the control-k shortcut to cut lines in the terminal anymore. How can I check (and change) the Terminal key bindings?
    Thank you!

    Basing on your input, you should get the following values:
    1) session keys
    SK_ENC: 6DCE2A99BACB5207A7A96A92F114D66C
    SK_MAC: 0D446132B168F75CD6F0A780693A4DD3
    SK_DEK: 19F7B0F94837F32874B29B5EFB7809F6
    2) host cryptogram
    1B781553209748EA
    3) Retail MAC
    01761103B810F00E
    Summing up, the External Authenticate command should have the following value:  84 82 01 00 10 1B781553209748EA 01761103B810F00E.
    Try to compare it with your results.
    Regards

  • My MacBook Pro is running very slow. How can I check is out?

    .My MacBook Pro is running very slow. How can I check is out?

    Backup your data.  Your disk/SSD may be failing.
    What has changed lately?
    - Has your disk/SSD filled up recently?
              How much free space? 
              Less than 10 GB? 
              Less than 20 GB?
    - Did you upgrade OS X recently (for example from 10.8 to 10.9 or 10.9 to 10.9.1)?
    - Have you installed any 3rd-party software recently?
    Run Disk Utility (from the Applications  > Utilities folder).
    - Click on the system disk (Macintosh HD) and Verify Disk.
    - Does it report errors or does it finish normally?
    Try an SMC Reset.
    http://support.apple.com/kb/HT3964
    Boot in Safe Mode.
    http://support.apple.com/kb/HT1564
    When in Safe Mode does it operate normally?
    After rebooting in normal mode is it faster?

  • I have two email accounts. It is only letting me check one. How can I check the other?

    I registered two different email accounts on my iPad mini. It's only letting me check one. How can I check the other one too?

    Congratuations on your new iPad!
    Since your device is so new, I can state categorically that this an issue with configuration. Delete the account that doesn't work, and enter the information anew.
    If you're still having problems, check that your email address and password are correct, and if possible, verify it by checking your ISP's settings.

  • How can i check my mails on the iphone and make sure that the mail wont pop up again on my computer ?

    How can i check my mails on the iphone and make sure that the mail wont pop up again on my computer/ will be deleted on the server ?

    For that kind of connectivity you need to be using an email account configured either as IMAP or Exchange.
    IMAP & Exchange accounts will maintain a sync across all your devices, so if you read / delete a message on your phone, it will disappear from the server as well. This cannot happen in POP email accounts.
    If your using gmail, instructions on how to set up exchange / imap are here http://www.google.com/support/mobile/bin/answer.py?answer=138740&topic=14252
    Alternatively, if its anything other than Google, you will need to contact your email providor or IT department (if your email address resides with an enterprise environment) to get the correct settings.
    Hope this helps!

  • How can multiple check boxes be added at one time to a form?

    How can multiple check boxes be added at one time to a form?

    Thanks for your response, but copying and pasting creates a link. If the user places a check mark in one of the boxes, all the rest of the boxes will have a check mark also. I will research this some more.
    Carol Deatherage
    Receptionist
    Novar/Honeywell
    1000 SE 14th Street
    Bentonville, AR 72712
    Office:  (800) 341-7795
    Fax: (479) 271-0657
    [email protected]<mailto:[email protected]>
    Your feedback is important to us! Please take a moment to rate this response.
    Click Here to Access the Survey<https://www.surveymonkey.com/s/NovarSurvey>!
    This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately.
    Novar Confidential ***

Maybe you are looking for

  • Windows Server 2008 backups failing

    I have a Windows Server 2008, fully patched that backups recently started to fail and now, we are unable to open the Windows Server Backup. Also unable to open Disk Management or any other applications requiring Virtual Disk. Attempts to start VDS fr

  • I have a doubt that my iPhone is a used one . Any tips on how i can check ?

    I plugged my newly purchased iphone 4s into my laptop to sync with i-tunes and it showed " Babajee's iPhone " , which i not me . Am hoping that its not a used one . When i bought the phone the shopkeeper entered his Apple Id to setup my phone . But f

  • NETCA error while installing client 10.2.0.1

    Hi: I am trying to install oracle client on my WinXP 32-bit and getting an error with netca. Need help to complete. Looks like it's a node-related problem. Do I have to create a tnsnames.ora first? Here is what I've got in the ConfigToolFailedCommand

  • CPU,Temp utilization for a particular schema

    Hi, There is a requirement to get the CPU utilization at a schema level for a particular database. Is this something we can get from AWR reports? Is there any other way of getting these reports. Regards, Narayan

  • How to sort on MULTIPLE Keys which are elements of VO's stored in  list

    How to sort on MULTIPLE Keys which are elements of VO's stored in a list.. without disturbing the ordering done by previous sorting...? Is there any best soln for the same... Thanks..