LV 8.5.X: Enum Constant, Number of Elements

Hello,
I want to determine the number of elements of an enum constant, is
that possible at all?
Thanks and greetings,
Udo

parthabe wrote:
What is the thing behind indexing 2?
I mean, how will I have to know that when I index 2, I ll get the Enum constant's item count...
That is buried inside the LabVIEW data-type definition:
Enumerated 8-Bit Integer
In the following example of an enumerated 8-bit integer for the items am, fm, and fm stereo, each group of characters represents a 16-bit word. The space enclosed in quotation marks (" ") represents an ASCII space.
0016 0015 0003 02a m02 fm 09f m" " st er eo
0016 indicates 22 bytes total. 0015 indicates an enumerated 8-bit integer. 0003 indicates there are three items.
Here's the VI I was talking about.
Ton
Message Edited by TonP on 06-10-2008 09:15 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!

Similar Messages

  • Determining the number of elements defined in an enum

    Hello,
    I have an enum and I want to determine the number of elements (constants) defined in this enum by source code. I know I can use reflection but I just want to know if there's an easier way.
    Thank you very much.

    Hey JavaWisdom,
    You can use the ordinal method. I made a simple example to demonstrate.
    public class NumberOfEnums {
         public static enum Enumeration {
              item1, item2, item3, item4
         public void count() {
              Enumeration[] values = Enumeration.values();
              int numElems = 0;
              for (Enumeration type : values) {
                   if (type.ordinal() > numElems) {
                        numElems = type.ordinal();
              // Correct 0 indexed numbering
              numElems += 1;
              System.out.println("numElems : " + numElems);
         public static void main(String args[]) {
              NumberOfEnums noe = new NumberOfEnums();
              noe.count();
    }Cheers,
    Cypher

  • What does enum constant do?

    Hi
    I have a program that I need to understand. There are enum constants at many places and I do not know what they do. When I find all instances it shows me many with other different named enum constants. Like enum "Read Queue" and "Initialize" are two enums and both are of the same instances. Can someone tell me what exactly an Enum is.
    Thanks

    Enum is an "enumerated" datatype.
    You have values of 0, 1, 2, ....   But those values are meaningless.  (Is "read queue" value #1?  Intialize value 0?)  So meaningful names are given to each of the values.  So if you want to initialize, you just have to pick that item in the enum rather than remembering an arcane number.
    A constant is a specific value.  Note: when working with enums, it is HIGHLY recommended that they be typedef's so that if you ever need to add an item to an enum, that all instances of the constans get that new item added to it automatically.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Using "Enum constant" in state machine.

    hallo all.
    i bild state machine, with 10 states. i move beetwen the states with Enum constant.
    my qustion is: if i want to add/delete some  states, why i need to update the Enum constant at every state ?
    there is  way to update "Enum constant" at one state, and  all other "Enum constant"(in other states) will update automatically
    thanks

    If you save you enum as a type def and replace all of the current occurences of the enum wi the type def, you shoud there after only have to update teh typedef.
    1) Find an oocurance of the enum
    2) Right-click and change to control.
    3) Find control and select Advanced customize
    3) Pull down on selector and change from "control" to "type def"
    4) Save control.
    5) close editor and when prompeted say yes to replace control.
    6) Change control back to constant
    7) replcae all previous occurances by choosing replace >>> the typedef'd control.
    8) Case structure will folow typed def from that point forward.
    Ben
    Message Edited by Ben on 12-24-2006 03:31 PM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • PCI-6133 always returns huge constant number of counts

    Hi,
    I am trying to use a PCI-6133 with a BNC-2110 adapter to counting leading edges of pulses.  Please excuse my high degree of ignorance of how to do this.  Anyway, I connected up my TTL input signal according to the BNC-2110 instructions (to PFI-8 via User-2). Whenever I run the DAQmx sample program Count Digital Events.vi, it recognizes the PCI-6133 OK, but always returns an absurdly high and constant number of counts, like 3.2e9.  The number doesn't change as I send test pulses into the input.  It also remains the same even if I disconnect the input line entirely and rerun the sample program.
    Rebooting yields the same behavior.
    Using DAQ assistant to generate my own code, instead of the sample program, produced exactly the same result.
    Thanks for any help you can give me.  I don't even know where to start to debug this problem.
    Thanks,
    Andy

    BVeezy wrote:
    How/what exactly are you measureing from;? Are you wiring the digital signal directly into PFI 8? Have your tried using the other counter (CTR1) on the 6133? It should be PFI 3 (as indicated in the manual). You may also try generating a pulse signal from the 6133 and reading it with this VI to determine if your source may be the issue (you could use PFI 2 as a Digital Output for this). Finally, does it read the same value every time you run it (the reported 3.2e9)?
    Regards,
    Brandon V.
    Applications Engineer
    National Instruments
    Thank you very much for your help.
    How/what exactly are you measureing from;?
    I am measuring (counting) TTL pulses coming from a TTL driver.  They are about 1 us long and nominal TTL high and low values.  The pulses look fine on a scope.  The rate is very low, typically a few Hz up to perhaps 200 Hz.  The behavior is the same regardless of whether I have the input signal connected to the BNC-2110, however.  The pulses are ultimately generated by a neutron detector, with a bunch of signal processing in between.
    Are you wiring the digital signal directly into PFI 8?
    The input signal is connected by BNC cable to the "User 2" port on the BNC-2110.  A jumper wire connects the "User2" PFI Terminal to the "PFI-8" PFI Terminal.  Again, the behavior is exactly the same regardless of whether these wires are installed or not.
    Have your tried using the other counter (CTR1) on the 6133?
    The behavior is exactly the same on ctr1, which has no wires connected to it.
    You may also try generating a pulse signal from the 6133 and reading it with this VI to determine if your source may be the issue (you could use PFI 2 as a Digital Output for this).
    I tried running a "test panel" in MAX to count the 20 MHz internally generated signal.  It gave the exact same results, on both ctr0 and ctr1.  It did not throw any error message.
    Finally, does it read the same value every time you run it (the reported 3.2e9)?
    It reads the same value every time I run the sample VI or test panel (3217997774) on both channels, except that the number changes to a different constant number (very close) when I reboot the computer.
    I have been wondering if the problem might be associated with the configuration of the ports on the PCI-6133.  The manual repeatedly says that you can configure the ports to input or output, for example, but it is not clear to me how to do that.  When I right-click the device in MAX, "Configure" is not one of the choices, despite what it says in the "Getting Started" manual.
    Again, thanks for your help. 
    Take care,
    Andyaina

  • How to avaoid java.lang.IllegalArgumentException: No enum const class

    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Test.java
    USEOFPROCEEDSVALUES useOfProceedsVar =USEOFPROCEEDSVALUES.valueOf(useOfproceeds);
    switch (useOfProceedsVar) {   
                   case U1:
                   revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U2:
                        revenueSourceCode="REVENUE _SOURCE_CODE.WATER";
                   break;
                   case U3:
                        revenueSourceCode="REVENUE_SOURCE_CODE.POWER";
                        break;
                   case U4:
                             revenueSourceCode=REVENUE_SOURCE_CODE.POWER";
                        break;
    default:
                        revenueSourceCode=null;
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raising
    How to avoid this exception
    Thanks for early reply

    user818909 wrote:
    HI ,
    Iam getting java.lang.IllegalArgumentException when iam using switch case through Enum contants.
    //Enum Constants declaration
    public enum USEOFPROCEEDSVALUES { U1,U2,U3, U4}
    //Using Enum in Java class
    Exception raising if there is either of these not U1,U2,U3,U4 ara not avalabele. i.e is if useOfProceedsVar is A6 then exception raisingActually useOfProceedsVar can never be A6, it can only take a value from the enum.
    The exception will be raised by valueOf, which (quite correctly) throws it if the String you pass to it doesn't match any of the enum constants.
    >
    How to avoid this exception
    Don't avoid it, process it. What do you want your code to do if the string doesn't match any of your enum constants? Whatever it is, stick it in a catch clause.

  • Any possible workaround to use annotations that require an enum constant...

    I am doing code generation and following the generation gap pattern (http://www.research.ibm.com/designpatterns/pubs/gg.html). For JPA i add a few annotation like @Table or @Inheritance to the generated-once client class and not the always-generated base class. However the problem is that if the values of those annotations change, it doesnt get reflected in the generated-once code, since its only generated once - the 1st time and never touched again.
    So was trying in some way to get the annotations be on the base class thats always generated and did whats mentioned in this newsgroup post http://www.eclipse.org/newsportal/article.php?id=79805&group=eclipse.platform#79805
    However it doesnt work since java doesnt like non enum constants in the annotation.
    I wonder if there is some approach people have come across to address this kind of problem? (apart from say generating an orm.xml always to put annotations in there)

    Priyajeet wrote:
    Thats what I am generating. One class is getting split into two. One always generated, while the other generated once.
    You are still missing the point of the pattern.
    The pattern is
    <Class that is NOT generated> becomes <generated class> <manual class>
    And as I already said the fact that you have another generated class doesn't mean that you can't apply the pattern to second class.
    Consider this UML diagram where A --> B means A extends B
    4 Files get generated
    1] ABase extends B (always generated)
    2] A extends ABase (generated-once)
    3] BBase (always generated)
    4] B extends BBase (generated once)
    It is 2 and 4 that will get the annotations for JPA - @Entity, @Table and @Inheritance.
    1 and 3 will get @MappedSuperclass.
    So my problem above that I mention applies to the Child (A or B) and not Parent (ABase or BBase)
    The seperation into functional units are joined by inheritance.
    Java doesnt have partial class methodology.
    So inheritance joins the 2 functional units.That entire explanation doesn't matter. Actually the pattern doesn't matter either.
    Code generation, all code generation is simple.
    You take 'source', run it through a 'tool' and the output is 'code'.
    For that to work you MUST have 'source' and a 'tool' that produces the 'code' that you want. If one of those pieces is missing you can't use code generation.
    The variations on that are infinite. The only limitation is complexity and that at some point you reach a point of diminishing returns where it costs more to do the code generation (including maintainance) than it does to do it manually.
    So your options are
    1. Find some way to generate it all.
    2. Find some way to seperate some of the code out so some can be generated and the other is manual (and this is sort of the point of the pattern.)
    3. Do it manually.
    There is no magic. I would also like to suggest that you forget about the pattern entirely. It is clever but it is more of a intro to code generation and you appear to be limiting the possibilities by that pattern and you do not need to do that.

  • There is a constant number beside all of my emails.  how do i fix?

    I have a constant number beside all of my emails.  How can I change it to an individual number for each email?

    Starting with the simplest, try checking in the Deleted/Trash folder in thunderbird. If it was not found there, you can check the web interface if it still remains there (depending on the provider and your thunderbird settings).
    If the above didn't help you find the email you lost, check [http://kb.mozillazine.org/Undelete_a_message Undelete a message]

  • Overriding toString for enum constants

    can anybody please point me to some sort of example or documentation for overriding toString for (individual) enum constants. the javadoc indicates that this should be possibly but it is not entirely clear to me how to do so.
    thanks in advance

    i had actually coded the following before posting, I just wanted to find alternatives or "best practice":
    protected static enum WorkflowState {
              REFERRAL_CREATED,
              QUOTE_CREATED,
              ORDER_APPROVED,
              ORDER_CREATED;
              public String toString() {
                   String str = null;
                   switch(this) {
                   case REFERRAL_CREATED:
                        return "Opened";
                   return str;
         }

  • Set number of elements in a two dimensional array

    Hi,
    Does anyone know how to set the number of elements in a two dimensional array directly in teststand.
    To set a one dimsional array is simple:
    SetNumElements( locals.somearray,4)
    Is there a method to do this for a two dimensional array?
    Sean

    From the help file (TestStand 4.2.0):
    PropertyObject.SetNumElements
    SetNumElements Method
    Syntax
    PropertyObject.SetNumElements ( numElements, options = 0)
    Purpose
    Sets the number of elements of a single dimensional array.
    Remarks
    This method is only valid for single dimensional arrays. The elements in the array retain their values. Use the PropertyObjectType.ArrayDimensions property to set the number of elements in each dimension of a multi-dimensional array.
    Parameters
    numElements As Long
    [In] New number of elements for the array.
    options As Long
    [In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options.
    This parameter has a default value of 0.
    So you could use, for example: Locals.MultidimensionalArray.Type.ArrayDimensions.SetBounds({1,0},{3,4}) to set an array to have three dimensions (1,2,3), each with five elements (0,1,2,3,4).

  • Number of elements in TDMS file

    Is there a way to determine the number of elements in a TDMS file?  The files I am creating have several signals all of the same length.  The only way I can think of is to do this is put it in a loop and read one element at a time until it reaches the end of the file.  But, my files will have millions of elements.  Any suggestions?
    Thanks.
    --Robert

    Thanks Herbert
    For readers having similar problems, here are my experiences:
    It works either without wiring a property name and datatype, as you mentionned before.
    Resulting is a variant array. Result see attached solutionVariant.jpg
    It also works wiring the right datatype as in the TDMS File Viewer and your first explanations:
    Resulting is the channel length as Integer I64 or U64. Datatype constant representation and indicator representation must match!
    See attached solution.jpg
    My error has been wiring a string "I64" as datatype and a string indicator as value indicator. So stupid...
    Regards
    Klaus
    Attachments:
    solutionVariant.jpg ‏30 KB
    solution.jpg ‏8 KB

  • How to get the number of elements in a tilelist

    I'm writing test cases for a flex application using FlexSelenium and I need to get the number of elements displayed in the tilelist.
    I know that that the tilelist is fed by an array. but i can't access that array from my test case.
    Can anyone tell me how I can get the number of elements in a tilelist on the application? which property of the tilelist can provide that number?

    try tileList.dataProvider.length;

  • How to get the number of elements in DB

    Could you tell me how to get the number of elements in DB??
    My code to get the number is below, but I think it is not efficient
    DB->cursor(DB, NULL, &cursorp, 0);
    while ((ret = cursorp->c_get(cursorp, &key, &data, DB_NEXT)) == 0)
    count++;
    --------------------------------------------------------------------------------------------------------------

    Hi,
    The most efficient way to get a count from the database is using the DB->stat API (http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbstat.html)
    The code will be something like:
            DB *dbp;
            DB_BTREE_STAT *statp;
            int ret;
            /* Print out the number of records in the database. */
            if ((ret = dbp->stat(dbp, NULL, &statp, 0)) != 0) {
                    dbp->err(dbp, ret, "DB->stat");
                    goto err1;
            printf("%s: database contains %lu records\n",
                progname, (u_long)statp->bt_ndata);
            free(statp);The code comes from the example included in the distribution at examples/c/ex_btrec.c
    If the database isn't a btree, you should update to the appropriate statistics structure and field.
    It's worth noting that retrieving the count is never a "cheap" operation. The count is not stored in the database - since doing so introduced a single point of contention that creates a bottle neck.
    Regards,
    Alex Gorrod
    Oracle Berkeley DB

  • Number of elements at logical level / odbc driver

    Hi everyone,
    I'm new in BI area and I cannot understand one basic thing.
    I study documentation about BI server, exactly chapter about "creating dimensions" and I'm confused about setting "number of elements at logical level"
    It looks for me that "number of elements at logical level" is static.
    What will be when someone update data in the table and number of elements will be different than number of elements in our logical level?
    example:
    current column with distinct values:
    channel_desc:
    direct sales
    tele sales
    catalog
    internet
    partners
    in this case I set number of elements at logical level 5.
    after a while some update data in the table and our column looks (see below)
    column after update with distinct values:
    channel_desc:
    direct sales
    tele sales
    catalog
    internet
    partners
    others (added value)
    Does it mean that I have to change it to current numbers of elements?
    I'm sure that this is misunderstanding in my case, but I don't know where?
    Second problem which I have:
    BI with oracle database is on linux
    client software on windows
    I can import data from database like sybase or flat files to the physical model, I can view data, but when I create whole model (physical, bussines model and mapping, presentation) and I try access data from "Answers" I have this error:
    "Data source name not found and no default driver specified"
    regards
    Bart

    Number of elements is just an indication used by the BI Server (e.g. when generating LOV's in Answers). It won't cause any problems when it doesn't hold the exact number of elements available in the dataset.

  • Number of elements - Dimensional Hierarchy

    Hi,
    In a *'Dimensional Hierarchy'*, while creating a new *'Parent level'*, a 'Logical Level' dialogue box prompts for entering *'Number of elements at this Level'*+. What is its significance ?
    What is achieved by+ *'Number of elements at this Level'* +?+
    Thanks in Advance & Regards,
    Deeba

    Hi deeba,
    Its not mandatory to specify the number of elements in hierarchy....if you wont mention also by default it takes the value of 1.....Above vino gave you the link for explanation.
    Hope it helps you...Award points and close the thread.
    By,
    KK

Maybe you are looking for

  • Is the iSO6 upgrade compatible with the iPhone 4?

    Is the new iSO6 upgrade compatible with the iPhone 4 or is it going to cause problems with it?

  • Putting iMovie events back on the computer from backup disk

    I moved some events to an external disk, and now I want to bring them back to my computer since I will be working with the video and dont want to leave my backup drive down here in the office (I store it in a fire proof safe). HOw do I do this, I see

  • Problem after installing 10.4.8

    Hello, I installed the 10.4.8 update today. I have a brand new macbook. When the update finished downloading, my screen just turned blank, my computer didn't react at all. I could hear the fan and that was it. So, I waited for some minutes, nothing h

  • .exe files will not open

    Whenever I download something to my computer (say an .exe file), when I try to open it, I get a message saying "Error Opening Movie" for Quicktime. The most recent file is not a movie, it is a game setup file. What should I be opening it with and how

  • Latest update of SwagBucks has hijacked my Open New Tab and uninstalling does not fix... so what now?

    The latest auto update of SwagBucks now locks the Open New Tab page into swagbucks.com. I've lost my TILES page. My HOME page is still correctly set and regardless of what that is, the Open New Tab page always goes to SwagBucks.com. I've removed ever