Abstract Trace into a string

HI Folks,
I am working on a graphical mapping and I am using a global container to write all my traces say     trace.addInfo("Line 1");   trace.addInfo("Line 4"); etc etc
Now I want to retrieve  the trace information and return them as a string or an array of string to another field/fields.
Can anyone suggest how can I write that abstract trace(which we can see while executing the mapping in test tab) information into a field ???
Thanks,
VK

HI Everyone,
Let me make my question simple:
I am not looking for something at the stage of writing data!!
Let us assume I dont have any chance to edit it!!!
My requirement is that if the data is already there in the trace, can we retrieve it ???
When we write data into abstract trace we can see it when we execute the mapping (Just a java i/o stuff).
but I want to retrieve the data from abstract trace in some field mapping!!!
Hope this explains my question!!!
Thanks & Regards,
VK

Similar Messages

  • Get stack trace into a string with CLDC

    I want to get the stack trace of an application into a string, so that I may print the stack trace elsewhere.
    CLDC api does not have a printStackTrace(PrintWriter pw) or printStackTrace(PrintStream ps) which is present in j2se.
    Could you please suggest another way in CLDC to obtain the stack trace into a string.

    Set System.err to your designated PrintStream and then call Throwable.printStackTrace().
    This will do what you desire.
    rob,

  • Trace into makes source code screen go blank

    Trying to walk through this code segment on inner classes from Bruce Eckel's Thinking in Java. When I hit trace into (F7), the trace into starts (as I can watch the sequence in Context Browser, but I the source code window goes blank with just a highlighted 1st line with no code shown.
    If I remove the extends to the interface and abstract class and comment out the respective casts and return values, the problem disappears. So, it must be related to the extending with inner classes.
    Anyone seen this before??? try it.
    abstract class Contents {
    abstract public int value();
    interface Destination {
    String readLabel();
    public class Parcel10 {
    private static class PContents extends Contents {
    private int i = 11;
    public int value() { return i; }
    protected static class PDestination implements Destination {
    private String label;
    private PDestination(String whereTo) {
    label = whereTo;
    public String readLabel() { return label; }
    public static Destination dest(String s) {
    return new PDestination(s);
    public static Contents cont() {
    return new PContents();
    public static void main(String[] args) {
    Contents c = cont();
    Destination d = dest("Tanzania");
    } ///:~

    Chris,
    I just tried your code using JDeveloper 3.2 - I can not reproduce your results.
    What I did was:
    -Created a Class named Parcel10,
    -Pasted your code below into it (everything except package statement).
    -Set a breakpoint on main
    -Right clicked on Parcel10 and selected Debug
    -Stepped into the code for all the steps and nothing odd happens.
    If you can produce a simple reproduce case,
    then we can look into this further.
    Thanks,
    -John
    null

  • How can I put all output error message into a String Variable ??

    Dear Sir:
    I have following code, When I run it and I press overflow radio button, It outputs following message:
    Caught RuntimeException: java.lang.NullPointerException
    java.lang.NullPointerException
         at ExceptionHandling.ExceptTest.actionPerformed(ExceptTest.java:72)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)Caught RuntimeException: java.lang.NullPointerException
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)I hope to catch all these error message into a String Variable such as StrErrorMsg, then I can use System.out.println(StrErrorMsg) to print it out or store somewhere, not only display at runtime,
    How can I do this??
    Thanks a lot,
    See code below.
    import java.awt.Frame;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.FileInputStream;
    import javax.swing.ButtonGroup;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    public class ExceptTest extends JFrame implements ActionListener {
        private double[] a;
      private JRadioButton divideByZeroButton;
      private JRadioButton badCastButton;
      private JRadioButton arrayBoundsButton;
      private JRadioButton nullPointerButton;
      private JRadioButton negSqrtButton;
      private JRadioButton overflowButton;
      private JRadioButton noSuchFileButton;
      private JRadioButton throwUnknownButton;
      public ExceptTest() {
        JPanel p = new JPanel();
        ButtonGroup g = new ButtonGroup();
        p.setLayout(new GridLayout(8, 1));
        divideByZeroButton = addRadioButton("Divide by zero", g, p);
        badCastButton = addRadioButton("Bad cast", g, p);
        arrayBoundsButton = addRadioButton("Array bounds", g, p);
        nullPointerButton = addRadioButton("Null pointer", g, p);
        negSqrtButton = addRadioButton("sqrt(-1)", g, p);
        overflowButton = addRadioButton("Overflow", g, p);
        noSuchFileButton = addRadioButton("No such file", g, p);
        throwUnknownButton = addRadioButton("Throw unknown", g, p);
        getContentPane().add(p);
      private JRadioButton addRadioButton(String s, ButtonGroup g, JPanel p) {
        JRadioButton button = new JRadioButton(s, false);
        button.addActionListener(this);
        g.add(button);
        p.add(button);
        return button;
      public void actionPerformed(ActionEvent evt) {
        try {
          Object source = evt.getSource();
          if (source == divideByZeroButton) {
            a[1] = a[1] / a[1] - a[1];
          } else if (source == badCastButton) {
            Frame f = (Frame) evt.getSource();
          } else if (source == arrayBoundsButton) {
            a[1] = a[10];
          } else if (source == nullPointerButton) {
            Frame f = null;
            f.setSize(200, 200);
          } else if (source == negSqrtButton) {
            a[1] = Math.sqrt(-1);
          } else if (source == overflowButton) {
            a[1] = 1000 * 1000 * 1000 * 1000;
            int n = (int) a[1];
          } else if (source == noSuchFileButton) {
            FileInputStream is = new FileInputStream("Java Source and Support");
          } else if (source == throwUnknownButton) {
            throw new UnknownError();
        } catch (RuntimeException e) {
          System.out.println("Caught RuntimeException: " + e);
          e.printStackTrace();
          System.out.println("Caught RuntimeException: " + e);
        } catch (Exception e) {
          System.out.println("Caught Exception: " + e);
      public static void main(String[] args) {
        JFrame frame = new ExceptTest();
        frame.setSize(150, 200);
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.show();
    }

    yes, I update as follows,
    but not looks good.
    import java.io.*;
    public class UncaughtLogger implements Thread.UncaughtExceptionHandler {
        private File file;
        private static String errorMessage;
        public UncaughtLogger(File file) {
            this.file = file;
            //Thread.setDefaultUncaughtExceptionHandler(this);
        public UncaughtLogger(String str) {
            this.errorMessage = str;
            Thread.setDefaultUncaughtExceptionHandler(this);
        //@Override()
        public void uncaughtException(Thread t, Throwable e){
            try {
                log(e);
            } catch (Throwable throwable) {
                System.err.println("error in logging:");
                throwable.printStackTrace();
        private void log(Throwable e) throws IOException {
            PrintWriter out = new PrintWriter(new FileWriter(file, true));
            try {
                e.printStackTrace(out);
            } finally {
                out.close();
        private static UncaughtLogger logger = new UncaughtLogger(new File("C:/temp/log.txt"));
        private static UncaughtLogger logger2 = new UncaughtLogger(errorMessage);
        public static void main(String[] args) {
                String s1 = "Hello World!";
                s1 = null;
                String s2 = s1.getClass().getName();
                System.out.println(s1);
                System.out.println(s2);
                System.out.println("errorMessage =" + errorMessage);
    }

  • How to catch exception into a String variable ?

    I have a code
    catch(Exception e)
                e.printStackTrace();
                logger.error("\n Exception in method Process"+e.getMessage());
            }when i open log i find
    Exception in method Process null.
    But i get a long error message in the server console !! I think thats coming from e.printStackTrace().
    can i get the error message from e.printStackTrace() into a String variable ?
    I want the first line of that big stacktrace in a String variable.
    How ?

    A trick is to issue e.printStackTrace() against a memory-based output object.
    void      printStackTrace(PrintStream s)
             // Prints this throwable and its backtrace to the specified print stream.
    void      printStackTrace(PrintWriter s)
    //          Prints this throwable and its backtrace to the specified print writer.Edited by: BIJ001 on Oct 5, 2007 8:54 AM

  • Need to convert a long into a string, please

    hi there
    i need to convert a long into a string. can i just cast it like this:
    (String)longNumber = some function that returns a long;

    Why not just use Long.toString()? If you start with a long value, you can create a Long object and get it's value as a String.

  • How can I convert IDoc in XML format w/DTD into a string?

    I want to send by e-mail outbound IDoc in XML format with its document type definition (DTD).
    I want to be able to get the same output result into a string than the XML file IDoc port type with DTD activated.  I have created a FM (based on SAP "OWN_FUNCTION") assigned to an IDoc port of type ABAP-PI that executes the following processing steps:
    1-Extract outbound IDoc information to get the sender & recipient mail addresses (EDP13 / EDIPHONE tables).
    2-Convert & Transform IDoc data into XML string using FM IDX_IDOC_TO_XML.
    3-Prepare and send e-mail with XML attachement using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    I cand generate the e-mail with the XML file attachement but FM IDX_IDOC_TO_XML does not convert the IDoc with proper formating and DTD.
    What should I use to accomplish the IDoc conversion to XML w/DTD into a string?
    Should I use XSLT tools ?
    How does that work?
    Thank you
    Carl

    muks wrote:
    Use decimal string to number
    Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
    LabVIEW Champion . Do more with less code and in less time .

  • Is there a way to force the cursor into a string control when a vi is called

    In a .vi I'm wrighting I need to input a new serail number at the beginning of each run. Is there a way to force the cursor into the string control box every time the start screen returns? eliminating the need for the operator to move the mouse around and click.
    I would like to THANK all that have replied to my questions in the past. It has been a big help!
    Thanks
    TeBlues

    ah, problem solved.  what a community.
    Message Edited by Space_Flight on 11-20-2006 10:08 AM
    Attachments:
    keyfocus.jpg ‏83 KB

  • I want to read the content of a text file dropped in a watched folder into a string variable

    I have a workbench process with 2 variable.
    inDoc (DataType=Document/input/required)
    outStr (DataType = String/output)
    The document being passed to the workflow is a text file with 4 lines of text in it.  when the text file is dropped into the watched folder, it will be assigned to the inDoc parameter in the workflow.
    My workflow needs to extract the 4 lines of text and write it into a string (outStr).
    Id like to use the FileUtilsService.ReadString service but i can't since its input parameter is the file path.  When i do, i get the following error...
    Caused by: ALC-FUT-001-011: File rO0ABXNyABZjb20uYWRvYmUuaWRwLkRvY3VtZW50yAEFUxsO+CEDACNJAAtfY2FsbGJhY2tJZFoADV9kZXNlcmlhb Gl6ZWRJABBfZGlzcG9zYWxUaW1lb3V0WgAJX2Rpc3Bvc2VkWgAZX2lzRGlzcG9zYWxUaW1lb3V0RGVmYXVsdFoAE19 pc1RyYW5zYWN0aW9uQm91bmRKAAdfbGVuZ3RoSQAOX21heElubGluZVNpemVaAAhfb3duRmlsZVoAC19wYXNzaXZhd GVkWgALX3BlcnNpc3RlbnRJABFfc2VuZGVyQ2FsbGJhY2tJZFoAEV9zZW5kZXJQYXNzaXZhdGVkWgARX3NlbmRlclB lcnNpc3RlbnRJAA5fc2VuZGVyVmVyc2lvbkkABl9zdGF0ZUwAC19hdHRyaWJ1dGVzdAATTGphdmEvdXRpbC9IYXNoT WFwO0wACF9jYWNoZUlkdAAfTGNvbS9hZG9iZS9pZHAvRG9jdW1lbnRDYWNoZUlEO0wADF9jYWxsYmFja1JlZnQAIUx jb20vYWRvYmUvaWRwL0lEb2N1bWVudENhbGxiYWNrO0wADF9jb250ZW50VHlwZXQAEkxqYXZhL2xhbmcvU3RyaW5nO 0wAC19kYXRhQnVmZmVydAAeTGNvbS9hZG9iZS9zZXJ2aWNlL0RhdGFCdWZmZXI7TAAPX2V4cGlyYXRpb25UaW1ldAA QTGphdmEvbGFuZy9Mb25nO0wABV9maWxldAAOTGphdmEvaW8vRmlsZTtMABBfZ2xvYmFsQmFja2VuZElkdAAhTGNvb S9hZG9iZS9pZHAvRG9jdW1lbnRCYWNrZW5kSUQ7WwAHX2lubGluZXQAAltCTAAMX2lucHV0U3RyZWFtdAAVTGphdmE vaW8vSW5wdXRTdHJlYW07TAAPX2xvY2FsQmFja2VuZElkcQB+AAhMAAxfcHVsbFNlcnZhbnR0ACRMY29tL2Fkb2JlL 2lkcC9JRG9jdW1lbnRQdWxsU2VydmFudDtMABFfcmFuZG9tQWNjZXNzRmlsZXQAGkxqYXZhL2lvL1JhbmRvbUFjY2V zc0ZpbGU7TAAVX3NlbmRlckNhbGxiYWNrUmVmSU9ScQB+AARMABZfc2VuZGVyR2xvYmFsQmFja2VuZElkcQB+AAhMA A1fc2VuZGVySG9zdElkcQB+AARMABVfc2VuZGVyTG9jYWxCYWNrZW5kSWRxAH4ACEwAGl9zZW5kZXJQdWxsU2VydmF udEpuZGlOYW1lcQB+AARMAARfdXJsdAAOTGphdmEvbmV0L1VSTDt4cHcGAAAAAwAAcHd1AHMwOjA6MDowOjA6MDowO jEvMTI3LjAuMC4xLy8vLy8vLy8vZmU4MDowOjA6MDo3NDMyOmU0OWQ6NmUzMToxNTU0JTEwLzEwLjI0LjIzOS4xMjY vZmU4MDowOjA6MDowOjVlZmU6YTE4OmVmN2UlMTEvLy8vdXIAAltCrPMX+AYIVOACAAB4cAAAAcRJTU01MjU3XzAxL TIwMTFfMXwwMXx8YXx8fHxGZW1hbGV8MjAwMHw2fDh8Y3wyNTZ8MjU2fDkxMnwwMXx8fHx8fHx8Tnx8fHx8fHx8fHx 8fHx8fHx8fHxZfHx8fHx8fHx8fDAyfHx8fHx8TnwyMDEyfDJ8MTR8DQpJTU01MjU3XzAxLTIwMTFfMnx8fHx8fHx8f Hxhc2RmfDI1NnwyMDEyfDAyfDAxfDIwMTJ8MDN8MDJ8fHx8YXxhfDI1Mnx8fHxZfHx8fHx8fHx8fHx8fHx8DQpJTU0 1MjU3XzAxLTIwMTFfM3xOfHx8fHx8fHx8fDIwMDB8Nnx8fGFzZGZ8YXNkZnxhc2RmfDI1Nnx8fHx8fHx8fHx8fHx8f Hx8fHx8DQpJTU01MjU3XzAxLTIwMTFfNHxOfE58fE58TnxOfHxOfE58fE58TnxOfA0KSU1NNTI1N18wMS0yMDExXzV 8U2luZ2xlfDAxfHwyMDEyfDAyfDE4fDIwMTJ8MDN8MDN8MjM0fGFzZGZ8fGFzZGZhc3x8fHxFeGNoYW5nZS1Qcm8uO S40MDEuRnVsbC5XSU4uZW5fQ0EuRU5VLTEwLTIwMTF8DQoNCnBwdwYAAAAAAAB0AAp0ZXh0L3BsYWlucHNyABFqYXZ hLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAA AADdAAKd3NmaWxlbmFtZXQAJ0M6XFVzZXJzXENodWxseS5QYXJrXERlc2t0b3BcaGRzY2FuLnR4dHQACGJhc2VuYW1 ldAAKaGRzY2FuLnR4dHQABGZpbGVxAH4AFXh3NwAtYWRvYmUvaWRwL0RvY3VtZW50UHVsbFNlcnZhbnQvYWRvYmVqY l9MQ19ERVYx//////////94 does not exist.
    at com.adobe.livecycle.fileutils.FileUtilsService.readDocument(FileUtilsService.java:363)
    which is what i expected...
    I've also tried with the Script.executeScript to call some java code but im not too strong in java and in all the examples i find, the file pointer requires a file path.
    import java.io.*;
    FileInputStream f = new FileInputStream(patExecContext.getProcessDataValue("/process_data/inDoc"));
    OR
    File f = new File(patExecContext.getProcessDataValue("/process_data/inDoc"));
    OR
    File f = patExecContext.getProcessDataValue("/process_data/inDoc");
    Any clue how to resolve my problem?

    Try the following code snippet to read the String content from the file recieved through watched folder endpoint.
    com.adobe.idp.Document inputDoc = patExecContext.getProcessDataDocumentValue("/process_data/inDoc");
    java.io.InputStream inStream = inputDoc.getInputStream();
    byte[] dataBuffer = new byte[inStream.available()];
    inStream.read(dataBuffer);
    String strData = new String(dataBuffer);
    patExecContext.setProcessDataStringValue("/process_data/outStr",strData);
    The code is not tested, hence if you find any mistakes, correct and test the functionality.
    Nith

  • Need to concatonate multiple values for same key columns into one string

    Hi...I'm attempting to use PL/SQL to read through a table containing more than one column value for a set of keys, and concatonate those values together into one string. For example, in the STUDENT table, for a STUDENT_ID there are multiple MAJORS_ACCOMPLISHED such as History, Biology and Mathematics. Each of the majors is stored in a different row with the same STUDENT_ID due to different faculty DEPARTMENT values.
    I want to read through the table and write out a single row for the STUDENT_ID and
    concatonate the values for MAJORS_ACCOMPLISHED. The next row should be another STUDENT_ID and the MAJORS ACCOMPLISHED for that student..etc.
    I've hit a wall trying to use cursors and WHILE loops to get the results I want. I'm hoping someone may have run across this before and have a suggestion. Tks!!

    I think you are looking for string aggregation.
    The following are the replies posted by me in the forum recently on the same case.
    they might help you.
    Re: Concatenating multiple rows in a table - Very urgent - pls help
    Re: Doubt in a query ( Urgent )
    Re: How to remove words which consist of max 2 letters?
    Re: output like Name1,Name2,Name3...

  • How do I pass single quotes into a string variable?

    Thanks for any help?
    Example
    Select xdat, yday
    from foo
    where
    xdat = to_char(sysdate, 'mm/dd/yyyy')
    How do I pass the single quoted stuff above into a string variable?

    Thank you but that is not the same thing. I am building a dynamic sql statement and need to pass the quoted material into a statement that is quoted Is that not what my example above shows?
    My example above has a quoted string inside a string. I think this is exactly what you were asking for.

  • How to store serval char variables into a string variable?

    I have serval char variables, but i don't know how to put them together (without using arrays). I am thinking to store these char variables into a string variable but i don't know how to do it. For example,
    char letter1 = 'a', letter2 = 'b', letter3 = 'c';
    String letters;
    then how can i do to make letters = "abc" from using letter1,2,3?
    I am just a beginner of Java, if anyone can help me, i will appreciate that very much!!!

    String letters=""+leter1+letter2+letter3;is fine and dandy. What it actually compiles to is
    String letters = new StringBuffer().append(letter1).append(letter2).append(letter3).toString();Which ofcourse is much more code to write, but still good to know.
    So do see the API for java.lang.StringBuffer.
    Heikki

  • How to convert hex into a string value

    hei evryone!
    can anyone please help me on how to convert a hex value into a string suppose.. Example i want to convert 4275646479 which is a hex value, into a string "BUDDY"? how will i do that???
    Any suggestion, tutorial site would be appreciated?
    Thx!

    something like this will convert string to byte[]
    e.g.
    you want to convert following.
    656667 => ABC
    String toConvert = "656667";
    byte[] returnVal = String2byteArr (toConvert );
    String FinalStr = new String(returnVal);
    public static byte[] String2byteArr(String Result)
    byte[] byteRet = new byte[Result.length()/2];
    int k=0;
    for (int j=0; j<(Result.length()); j+=2)
    try
    Integer I = new Integer (0);
    I = I.decode ("0x"+Result.substring(j, j+2));
    int i = I.intValue ();
    if (i > 127)
    i = i - 256;
    byteRet[k++] = new Integer(i).byteValue();
    catch(Exception e)
    System.err.println(e);
    return byteRet;
    }// String2byteArr
    Hope this will help you, So that i can get 3$ (:-)
    Avi

  • How to add elements into java string array?

    I open a file and want to put the contents in a string array. I tried as below.
    String[] names;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
                    String item = s.next();
                    item.trim();
                    email = item;
                    names = email;
                }But I know that this is a wrong way of adding elements into my string array names []. How do I do it? Thanks.

    Actually you cannot increase the size of a String array. But you can create a temp array with the lengt = lengthofarray+1 and use arraycopy method to copy all elements to new array, then you can assign the value of string at the end of the temp array
    I would use this one:
    String [] sArray = null;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
        String item = s.next();
        item.trim();
        email = item;
        sArray = addToStringArray(sArray, email);
    * Method for increasing the size of a String Array with the given string.
    * Given string will be added at the end of the String array.
    * @param sArray String array to be increased. If null, an array will be returned with one element: String s
    * @param s String to be added to the end of the array. If null, sArray will be returned.(No change)
    * @return sArray increased with String s
    public String[] addToStringArray (String[] sArray, String s){
         if (sArray == null){
              if (s!= null){
                   String[] temp = {s};
                   return temp;
              }else{
                   return null;
         }else{
              if (s!= null){
                   String[] temp = new String[sArray.length+1];
                   System.arraycopy(sArray,0,temp,0,sArray.length);
                   temp[temp.length-1] = s;
                   return temp;
              }else{
                   return sArray;
    }Edited by: mimdalli on May 4, 2009 8:22 AM
    Edited by: mimdalli on May 4, 2009 8:26 AM
    Edited by: mimdalli on May 4, 2009 8:27 AM

  • How do I copy the string portion of an enum into the string portion of a cluster?

    I want to do this for the an entire array of clusters.  I'm trying to use a for loop.  Can't figure out how to parse the string portion of the enum into the string portion of the cluster.
    Alternatively, I'd be happy if I could figure out some way to tie the enum to the array of clusters, but I figure that gets problematic.
    DH
    Solved!
    Go to Solution.

    Dark Hollow wrote:
    OK, let's say that the enumerated type has N elements.  I want to initialize an N element array of strings.  How do I reference each string in the enumerated type to get to each string?
    Easy way to do this is to use GetNumericInfo.vi, part of the Variant library, found in vi.lib\utility\VariantDataType\GetNumericInfo.vi.  Wire your enumeration to the Variant input; one of the outputs is an array of the strings in the enumerated type.
    The more complicated way is a for loop, in which you typecast the iterator terminal value to the enumerated type, then use Format Value.  You can get the maximum value of the enumeration by casting 0 to the enumerated type, then decrementing; cast that back to a numeric and add one to get the right value to wire to the N terminal.
    EDIT: just thought I'd add, since RavensFan's reply popped up while I was writing mine - I don't like the Strings[] approach because it doesn't work on RT targets, and I lost a lot of time once due to this trying to figure out why my code wouldn't run properly on an RT system but worked great on my development computer.

Maybe you are looking for