How do u convert string to boolean?

Hi ,
Please find attached part of as vi. Global string is a global variable of string type. I would like to know how to connect it to the  rest of the block diagram. The case structure shown is of boolean type.The global string must display the color indicated in the case structure which  is red .
Thanks
SR
Attachments:
issue.ppt ‏81 KB

If you do something like the attached picture, it will set the value of a string indicator and color the text either red or green. You are making things way too complicated and the code you've tried to implement isn't even close to what you want to accomplish and the Boolean to String isn't what was suggested in your other post on the subject.
Message Edited by Dennis Knutson on 07-18-2006 12:22 PM
Attachments:
Set Text Color.JPG ‏8 KB

Similar Messages

  • Converting String to boolean not working

    Hello there - I am having a bit of trouble - I am trying to write a program to evaluate boolean expressions (fully parenthesized) As StringTokenizer goes through the expression, the boolean values are being pushed (as Boolean objects) and popped (converted to String) correctly, but the expression I am using to evaluate them is evaluating false (see my debug below)
    In my current code, I have op1 and op2 coming off of the stack as Strings but am not sure if Boolean.getBoolean() is the right method to use to convert them to boolean values. The Sun docs weren't very helpful and there wasn't anything that I could find on the Sun forum about converting Strings to boolean (vs. Boolean). This is what my evaluate code looks like:
    if (operation.equals("||")) {
    opB1 = Boolean.getBoolean(op1);
    opB2 = Boolean.getBoolean(op2);
    test = (opB1 || opB2);
    System.out.println("test = (opB1 || opB2) " + (opB1 || opB2)); //debug
    System.out.println("opB1 = " + opB1 + " opB2 = " + opB2); //debug
    In the above example - using the expression "( ( 1 < 2 ) && ( 2 > 1 ) )" my debug reads like this:
    Operator added to stack is (
    Operator added to stack is (
    Operand added to stack is 1
    Operator added to stack is <
    Operand added to stack is 2
    Operation removed from stack is <
    Operand removed from stack is 2
    Operand removed from stack is 1
    Boolean operand added to stack is true
    Operation removed from stack is (
    Operator added to stack is &&
    Operator added to stack is (
    Operand added to stack is 2
    Operator added to stack is >
    Operand added to stack is 1
    Operation removed from stack is >
    Operand removed from stack is 1
    Operand removed from stack is 2
    Boolean operand added to stack is true
    Operation removed from stack is (
    Operation removed from stack is &&
    Operand removed from stack is true //NOTE: values are both true
    Operand removed from stack is true
    test = (opB1 && opB2) false //NOTE: expression is evaluating as false
    opB1 = false opB2 = false //NOTE: converted String went from true to false!!
    Boolean operand added to stack is false
    Operation removed from stack is (
    When I changed the type of opB1 & opB2 to type Boolean, and use:
    if (operation.equals("||")) {
    opB1 = Boolean.valueOf(op1);
    opB2 = Boolean.valueOf(op2);
    test = (opB1 || opB2);
    System.out.println("test = (opB1 || opB2) " + (opB1 || opB2)); //debug
    System.out.println("opB1 = " + opB1 + " opB2 = " + opB2); //debug
    I get an error that || and && can't be used on type Boolean.
    I've spent several hours on this boolean part alone - any suggestions? (BTW - sorry for the long message!)

    You're a genius!! Wow I never would have figured that one out in a million years!! BTW - can you tell me how you got your code to be so nicely formatted in the post?
    Everytime I cut and paste - it looks aweful and all of the indentations are gone...
    Thanks again!!!

  • How can I convert string to the record store with multiple records in it?

    Hi Everyone,
    How can I convert the string to the record store, with multiple records? I mean I have a string like as below:
    "SecA: [Y,Y,Y,N][good,good,bad,bad] SecB: [Y,Y,N][good,good,cant say] SecC: [Y,N][true,false]"
    now I want to create a record store with three records in it for each i.e. SecA, SecB, SecC. So that I can retrieve them easily using enumerateRecord.
    Please guide me and give me some links or suggestions to achieve the above thing.
    Best Regards

    Hi,
    I'd not use multiple records for this case. Managing more records needs more and redundant effort.
    Just use single record. Create ByteArrayOutputStream->DataOutputStream and put multiple strings via writeUTF() (plus any other data like number of records at the beginning...), then save the byte array to the record...
    It's easier, it's faster (runtime), it's better manageable...
    Rada

  • How do i convert String type to an BinaryEntry Type ?

    We have to differentiate between keys that come to Erase method of custom publisher. So, we appended "|" at the end of the key as below
    key = "a"; //Actual key that is in Cache
    if(//some condition)
    newKey = "a|"; //newKey to differntiate
    getCache().remove(newKey);
    else
    getCache().remove(key);
    Now, the call comes to Erase method of our custom publisher. Here, we need to perform different operation for the key which has "|" in it. So, we added below code in custom Erase method.
    public void erase(BinaryEntry binEntry)
    String key = (String) binEntry.getKey();
    if(key.contains("|"))
    //Need to perform some DB operation here. Then,
    //now the key is "a|". we need to remove the "|" symbol and call erase method to remove the actual key ("a") from cache. So we added below code
    String newKey = (dnsDomainName).replace("|", "");
    //Here the problem is, key is of type String. But, Erase method can take only BinaryEntry type. So, we tried this
    binEntry = (BinaryEntry)(binEntry.getContext().getKeyToInternalConverter().convert(key));
    super.erase(binEntry); //but it dint work. The entry is not getting deleted from Cache.
    //How do we convert the key that is of String type to BinaryEntry ?
    else
    super.erase(binEntry);
    Can someone suggest ?

    LSV wrote:
    We have to differentiate between keys that come to Erase method of custom publisher. So, we appended "|" at the end of the key as below
    key = "a"; //Actual key that is in Cache
    if(//some condition)
    newKey = "a|"; //newKey to differntiate
    getCache().remove(newKey);
    else
    getCache().remove(key);
    Now, the call comes to Erase method of our custom publisher. Here, we need to perform different operation for the key which has "|" in it. So, we added below code in custom Erase method.
    public void erase(BinaryEntry binEntry)
    String key = (String) binEntry.getKey();
    if(key.contains("|"))
    //Need to perform some DB operation here. Then,
    //now the key is "a|". we need to remove the "|" symbol and call erase method to remove the actual key ("a") from cache. So we added below code
    String newKey = (dnsDomainName).replace("|", "");
    //Here the problem is, key is of type String. But, Erase method can take only BinaryEntry type. So, we tried this
    binEntry = (BinaryEntry)(binEntry.getContext().getKeyToInternalConverter().convert(key));
    super.erase(binEntry); //but it dint work. The entry is not getting deleted from Cache.
    //How do we convert the key that is of String type to BinaryEntry ?
    else
    super.erase(binEntry);
    Can someone suggest ?Excuse me, but you write here totally does not make sense on its own.
    1. What class is this method on?
    2. Why do you want to use a key in the place of an entry?
    If I correctly interpret what you try to achieve, your super-class implementation has to know how to deal with the trailing pipe character as you are never supposed to change the key on an entry, and the entry without the pipe does not exist either.
    Best regards,
    Robert

  • How do i convert void to boolean?

    Hi all,
    My problem is:
    This is one kind of java puzzle.
    if(System.out.println("I can "))
    The above sentence make the error like as incompatible type.cannot convert "void" to "boolean".Now I try to typecast void to boolean. It is not working at anyway.Please any have exposure about void to Object conversion.Please guide me.

    Don't put all your faith in Schrodinger....
    I repeated the "Schrodinger Cat" experiment, and
    could determine whether the cat was alive or dead.
    It was a function of time. After 4 or 5 days,
    s, the outcome was deterministic.Schr�dinger's Cat is bad OO. The cat does know its
    state, and that info should remain encapsulated. If
    you need it, you can still reference the animal and
    query it.Wouldn't the cat's state be more like a variable that has only been declared but not initialized? :^)
    - Saish

  • How does LabVIEW convert string to char* when passing them to a Call Library Node?

    I have a program which calls C++-based libraries which themself use external libraries (Qt). I pass strings to my library through the Call Library Node, and was wondering how the formatting goes? I have to interpret the char* according to Latin1, UTF-8, UTF-16, ... to convert them to a string which the Qt libraries understand. I need to use char* instead of LV strings, because the library is indepent of LabVIEW.
    It seems that interpreting the char* as Latin1 (default) does not work on Korean systems (for one of our customers), which is understandable when you know that the Latin character set does not know Korean signs. Anyone knows how the char* should be interpreted then? In other words, for non-Latin languages, what exactly is passed to the DLL?

    I don't think that we reinterpret your string in anyway, just reformat the data so that it can be passed to your dll. 
    So assuming you are getting text from, say, keyboard editing, the text should be in the ANSI codepage that the system is running under.  That is, if you are running Windows using an English locale, it will be codepage 1252 (Windows Western, Latin 1), if you are running Windows with a Korean codepage iirc it will be codepage 949, Unified Hangul code.
    If you are filling the string with data that you get from an instrument or some other fashion, it could really be anything.
    Here is a list of the codepages that Windows knows about
    http://msdn2.microsoft.com/en-us/library/ms776446(VS.85).aspx
    I do have some experience with Qt as well, and I think that the function you are looking for to create, say, a QString from this is:
    QString::fromLocal8Bit
    but I am not 100% certain about this as I am not a Qt expert.
    Jeff Peters
    LabVIEW R & D
    Message Edited by jpeters on 04-02-2008 12:38 PM

  • How can I convert a String into boolean?

    I am facing difficulty in converting String into boolean.
    For example, I have a few variable which i need user to input yes or no as the answer. But I uses string instead. Is there a way which i can ask them to input boolean directly?
    Please advise...
    credit = JOptionPane.showInputDialog("Enter Yes or No for Credit Satisfactory : ");
    System.out.println("The answer for Credit Satisfactory : "+credit);
    e_invtry=JOptionPane.showInputDialog("Enter Yes or No for inventry level");
    System.out.println("The answer for Quantity Order : "+e_invtry);
    Message was edited by:
    SummerCool

    Thanks...but I don't get it....I tried to use your
    suggestion but i got the message that " cannot find
    symbol method
    showConfirmDialog(java.lang.String,int)" ???
    Please advise.
    The code I use was :
    int credit = JOptionPane.showConfirmDialog("Enter Yes
    or No for credit satisfactory",
    JOptionPane.YES_NO_OPTION);Well that was not the example I gave you.
    JOptionPane has no method showConfirmDialog that receives a String and an int (exactly what the error message is telling you).
    What was wrong with the version I showed you?

  • How to convert String (dd-MMM-yyyy) to oracle.jbo.domain.Date

    Hi
    Could you please tell how do I convert String of date in format dd-MM-yyyy to ADF date? Please show me some sample.
    Thanks

    http://javaalmanac.com/egs/java.text/FormatDateDef.html
    Once you have a java.util.Date you can convert it to oracle.jbo.domain.Date. (see http://www.fifkredit.com/bc4jdoc/rt/oracle/jbo/domain/Date.html)

  • How do I convert a String to double~?

    The contents of a file named data.txt are shown below:
    1.2402 .7930 .3254 -.0994 -.2930 -.4233 -.4539 -.1423
    -.0007 -.3118 -.6208 -.9524 -1.3694 -1.3870 -.9214 -.3621
    .1633 .9746 2.0815 2.5352 1.8879 1.0037 .3276 -.2085
    I want to read these data from data.txt.
    Below are the code I use to read file:
    //read file
    BufferedReader br = new BufferedReader(objFileReader);
    //lstrLine contains one line data,
    String strLine = br.readLine();
    Question:How can I convert String strLine to double [ ] dbLine ?
    For example,convert String strLine=" 1.2402 .7930 .3254 -.0994 -.2930 -.4233 -.4539 -.1423" to dbLine[0]=1.2402,dbLine[1]=.7930,dbLine[2]=.3254,dbLine[3]=-.0994,dbLine[4]=-.2930,dbLine[5]=-.4233,dbLine[6]=-.4539,dbLine[7]=-.1423

    String.split(), DecimalFormat

  • Convert strings to publicKey/privateKey objects

    Hi,
    I have the following problem : I'm generating RSA key pairs in string formats. I want to sign an XML document so I have to specifiy KeyPair object in order to do that.
    How can I convert string to publicKey and privateKey objects ?
    i.e How can I correct this code :
    String pubKey = generatePublicKey();
    String priKey = generatePrivateKey();
    KeyPair kp = new KeyPair(pubKey,priKey);
    // sign the XML documents
    Thanks a lot for your precious help.
    Cheers,
    Othman.

    http://forum.java.sun.com/thread.jspa?threadID=577716&tstart=0

  • How can I convert an int to a string?

    Hi
    How can I convert an int to a string?
    /ad87geao

    Here is some the code:
    public class GUI
        extends Applet {
      public GUI() { 
        lastValue = 5;
        String temp = Integer.toString(lastValue);
        System.out.println(temp);
        showText(temp);
      private void showText(final String text) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            tArea2.setText(text + "\n");
    }

  • Need to convert a string to boolean

    i have string true, false, i need to convert them to boolean, is it good to use String.equals(true/false) or is it good to use Boolean.valueOf(true/false)
    Regards,
    Surya

    See http://forum.java.sun.com/thread.jsp?forum=54&thread=455788&tstart=0&trange=30.
    Remember, '=' is assignment, '==' is equals...

  • How can I convert  an ArrayList to a String[]

    Hi,
    How can I convert an ArrayList (only with strings) to a String[] ?
    I've tried this :
         public static String listToString(List l) {
              StringBuffer sb = new StringBuffer();
              Iterator iter = l.iterator();
              while (iter.hasNext()) {
                   sb.append(iter.next().toString());
                   if (iter.hasNext()) {
                        sb.append(',');
              return sb.toString();
    But what I get is an array of xxxxx@435634 (for example).
    Thanks a lot !

    Strings are Objects but not all Objects are Strings and at least one of the elements in your List is not a String.

  • How can I convert output data (string?) from GPIB-read to an 1D array?

    Hello all,
    I am reading a displayed waveform from my Tektronix Oscilloscope (TDS3032) via the GPIB Read VI. The format of the waveform data is: positive integer data-point representation with the most significant byte transferred first (2 bytes per data point).
    The output data of GPIB-Read looks like a string(?) where the integer numbers and a sign like the euro-currency sign are seperated by spaces e.g. #5200004C3 4 4 4 4 3C3C3........ (C represents the euro-currency sign).
    How can I convert this waveform data into a 1D/2D array of real double floatingpoint numbers (DBL) so I can handle the waveform data for data-analysis?
    It would be very nice if someone know the solution for this.
    t
    hanks

    Hi,
    First of all, I'm assuming you are using LabVIEW.
    The first you need to do is parse the string returned by the instrument. In this case you need to search for the known symbols in the string (like the euro sign) and chop the string to get the numeric strings. Here are some examples on parsing from www.ni.com:
    Keyword Search: parsing
    Once you parse the numeric strings you can use the "String/number conversion VIs" in the String pallette.
    Hope this helps.
    DiegoF.Message Edited by Molly K on 02-18-2005 11:01 PM

  • How do I convert an int to a String?

    How do I convert an int to a String?

    You can also use any of these methods if you need to get more complicated:
    Integer.toString(int i)
    Integer.toBinaryString(int i)
    Integer.toHexString(int i)
    Integer.toOctalString(int i)
    Integer.toString(int i, int radix)

Maybe you are looking for

  • ITunes 10.1 no longer syncs?

    After updating to the latest iTunes 10.1, it keeps crashing when attempting to sync new songs. Windows says iTunes isn't responding, checks for solution, and closes. This problem has only happened with this version of iTunes, and syncing music is the

  • Migration Assistant can't find my hard drive - can you help?

    Hi, I've just bought a new MacBook Pro (Lion) as my 6 year old iMac (Snow Leopard) has died. I wanted to restore my data from my iMac, via my Time Machine back-ups which are stored on a WD MyPassport. When using the migration assistant, I've followed

  • Can't locate music imported from CD

    I have re-installed iTunes on my new HP laptop and was able t retrieve most of my library from the cloud. I imported music from a CD but now cannot find it. Formerly on my desktop, a separate page would pop up and show the songs as they were being up

  • ABAP dump CONVT_NO_NUMBER

    Hi, One of our program is going into dump in production server giving convt_no_number error.  Inside the form the value is calculating by the program and storing it in a variable which is declared as INT4. This value is moved to another variable whic

  • How do I view the contents of my iPad in Mountain Lion?

    How do I view the contents of my iPad in Mountain Lion?