Parsing date from JSON response

Is there any helper method to parse date time value being returned in JSONResponse to get java.util.Date. For example, 2012-06-26T15:51:59.078-05:00. I have done simple java method using SimpleDateFormat, but that does not handle all possible formats. Anyone has ideas on libraries that can be used for this purpose?
Chandresh

Oh I see you receive different formats from different services, who's backend you can not modify.
I found this, it should help you get the job done:
http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat
Note however, that his problem is only relatively simplistic, yours on the other hand seems to be one of a kind where you have to be set up a pretty nifty algorithm taking care of all the different possible formats. That being said, there is no method which can parse ANY format you throw at it. you must write one yourself which knows which possible formats to expect.
If its only those two formats you can expect:
2012-06-26T15:51:59.078-05:00
2012-06-26T15:51:59-05:00
it should be an easy try-catch construct within a helper method. just be sure to use the right letters when setting up your SimpleDateFormat parse object, it's case sensitive and one quickly gets lost in all those letters.
Edit:
Again this should do the trick:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
Just make sure you remove the last ":" from the JSONString (simple string manipulation) and then have two cases
//removing last ":" from JSONString
//====
//Parsing string to date or gregCalendar
GregorianCalendar time= new GregorianCalendar();
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
time.setTime(sdf.parse(JSONString));
catch{
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
time.setTime(sdf2.parse(JSONString));
Edited by: Pascal B on 05.07.2012 04:50
Edited by: Pascal B on 05.07.2012 04:55

Similar Messages

  • Create dynamic controls from JSON Response

    I have a requirement to create a group of checkbox with lebels in a page from JSON response.
    The JSON response is
        "data": [
                "CodeStatus": "Red"
                "CodeStatus": "Orange"
                "CodeStatus": "Green"
                "CodeStatus": "Yellow"
    the  design is:
    the box is vertically scrollable, as it can have more color codes.
    Can anyone suggest how to design the above?
    If one can provide the implemantation code, that would be very good as I have very time to implement it.

    Have a look at templates and for more complex scenarios factory functions, which give you the ability to dynamically create controls from model data.
    SAPUI5 SDK - Demo Kit
    Regards,
    Jason

  • How do i parse data from the second jframe back to the first?

    Hello.
    I have a jFrame were I promt users to keep a list of Names in a jTable. (I keep data for something else, but lets say names.. ) Anyway, afterwords I want to add some extra parameters for each name. So I created a new frame, which is opened when user press an Edit button. The new frame opens and users can add for the specific name some extra data, like age, height, color, sex.. etc. that characterizes this person.
    On this second form i have a save button, which when its pressed i would like to keep this information for this name, so as when user press edit again from the first frame on the same Name the data that previously entered will be loaded (lets say that the user can not enter the say name again)
    I haven' t figured the code for the save Button, but with the rest I am fine.
    Can you give any ideas with structures that I have to use and how the action listener will have to be??
    When I set visible the new form i have made a constructor that loads the new form which have a label with the name of the person that is edited., but how do i parse data from the second form back to the first that is already opened??
    Thanks very much..

    I found it.. it was not so hard afterall..
    anyway, i quote the new code..
    package namelist;
    // Java core packages
    import java.awt.event.*;
    import java.util.*;
    // Java extension packages
    import javax.swing.*;
    import javax.swing.table.*;
    public class NamesGUI extends javax.swing.JFrame {
        //Variables for managing the jTables
        DefaultTableModel tableModel;
        Vector rows,cols;
        String[] colName1 = {"List of Names"};
        ManageJTables mJT = new ManageJTables();
        Hashtable h;
        /** Creates new form ProsAgentGUI */
        public NamesGUI() {
            h = new Hashtable();
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            Panel = new javax.swing.JPanel();
            ToolBar = new javax.swing.JToolBar();
            ADD = new javax.swing.JButton();
            EDIT = new javax.swing.JButton();
            REMOVE = new javax.swing.JButton();
            jButton1 = new javax.swing.JButton();
            TScrollPane = new javax.swing.JScrollPane();
            Table = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Names");
            setBackground(new java.awt.Color(0, 51, 51));
            Panel.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Names"));
            ToolBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
            ADD.setText("ADD");
            ADD.setToolTipText("");
            ADD.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            ADD.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ADDActionPerformed(evt);
            ToolBar.add(ADD);
            EDIT.setText("EDIT");
            EDIT.setToolTipText("");
            EDIT.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            EDIT.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    EDITActionPerformed(evt);
            ToolBar.add(EDIT);
            REMOVE.setText("REMOVE");
            REMOVE.setToolTipText("");
            REMOVE.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            REMOVE.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    REMOVEActionPerformed(evt);
            ToolBar.add(REMOVE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            ToolBar.add(jButton1);
            rows=new Vector();
            cols= new Vector();
            cols=mJT.addColumns(colName1, cols);
            tableModel =new DefaultTableModel();
            tableModel.setDataVector(rows,cols);
            Table.setModel(tableModel);
            TScrollPane.setViewportView(Table);
            org.jdesktop.layout.GroupLayout PanelLayout = new org.jdesktop.layout.GroupLayout(Panel);
            Panel.setLayout(PanelLayout);
            PanelLayout.setHorizontalGroup(
                PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(ToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
            PanelLayout.setVerticalGroup(
                PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(PanelLayout.createSequentialGroup()
                    .add(ToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(29, Short.MAX_VALUE)
                    .add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            System.out.println(h.toString());
    public void updateNamesTable (int id, String na){
         Integer i2 = new Integer(id);
         Object o2 = (Object)i2;
         if (h.containsKey(o2)){
            Name a = (Name)h.get(o2);
            a.name = na;
            h.put(o2,a);
         else {
             Name aa = new Name();
             aa.name=na;
             h.put(o2,(Object)aa);
        private void EDITActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            String name = Table.getValueAt(Table.getSelectedRow(),0).toString();
            int rowNum= Table.getSelectedRow();
            Integer i = new Integer(rowNum);
            Object o = (Object)i;
            updateNamesTable (rowNum, name);
            //public NameEditor(Name n,  Hashtable h, int id)
            NameEditor re = new NameEditor((Name)h.get(o), h, rowNum );
            re.setVisible(true);
        private void REMOVEActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            mJT.deleteRow(Table.getSelectedRow(), rows, Table);
        private void ADDActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            mJT.addRow(rows, Table);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NamesGUI().setVisible(true);
        // Variables declaration - do not modify
        javax.swing.JButton ADD;
        javax.swing.JButton EDIT;
        javax.swing.JPanel Panel;
        javax.swing.JButton REMOVE;
        javax.swing.JScrollPane TScrollPane;
        javax.swing.JTable Table;
        javax.swing.JToolBar ToolBar;
        javax.swing.JButton jButton1;
        // End of variables declaration
    public class NameEditor extends javax.swing.JFrame {
        Hashtable h;
        Name n;
        int id;
        /** Creates new form NameEditor */
        public NameEditor() {
            initComponents();
        public NameEditor(Name n,  Hashtable h, int id) {
            this.h=h;
            this.n=n;
            this.id=id;
            initComponents();
            NameField.setText(n.name);
            jTextField2.setText(n.weight);
            jTextField1.setText(n.height);
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            NameLabel = new javax.swing.JLabel();
            NameField = new javax.swing.JTextField();
            SaveBut = new javax.swing.JButton();
            jLabel3 = new javax.swing.JLabel();
            jLabel4 = new javax.swing.JLabel();
            jTextField1 = new javax.swing.JTextField();
            jTextField2 = new javax.swing.JTextField();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Name Editor");
            getAccessibleContext().setAccessibleName("Name Editor");
            NameLabel.setText("Name: ");
            NameField.setEditable(false);
            NameField.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    NameFieldActionPerformed(evt);
            SaveBut.setText("SAVE");
            SaveBut.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    SaveButActionPerformed(evt);
            jLabel3.setText("Height");
            jLabel4.setText("Weight");
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(layout.createSequentialGroup()
                            .addContainerGap()
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(layout.createSequentialGroup()
                                    .add(jLabel4)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jLabel3)
                                        .add(NameLabel))
                                    .add(16, 16, 16)))
                            .add(17, 17, 17)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField2)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE))))
                        .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                            .add(127, 127, 127)
                            .add(SaveBut)))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(NameLabel)
                        .add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(30, 30, 30)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel3)
                        .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(12, 12, 12)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel4)
                        .add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
                    .add(SaveBut)
                    .addContainerGap())
            pack();
        public void updateNameTable (){
         Integer i2 = new Integer(id);
         Object o2 = (Object)i2;
         h.put(o2,n);       
        private void SaveButActionPerformed(java.awt.event.ActionEvent evt) {                                       
    // TODO add your handling code here:
            n.height= jTextField1.getText();
            n.weight = jTextField2.getText();
        private void NameFieldActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NameEditor().setVisible(true);
        // Variables declaration - do not modify
        javax.swing.JTextField NameField;
        javax.swing.JLabel NameLabel;
        javax.swing.JButton SaveBut;
        javax.swing.JLabel jLabel3;
        javax.swing.JLabel jLabel4;
        javax.swing.JTextField jTextField1;
        javax.swing.JTextField jTextField2;
        // End of variables declaration
    }

  • Parsing data from indexed field

     
    Hi,
    A contractor is developing a program to parse data from a form that I created in LiveCycle. There are some tables in the form where text fields in the same column have the same base name and are assigned an index by LiveCycle. For instance, there might be a CompanyName column with 6 text fields in each of 6 rows, where the text fields are named as follows: CompanyName [0], CompanyName [1], CompanyName [2], CompanyName [3], CompanyName [4], CompanyName [5].
    The programmer of the parsing program is having trouble parsing the data for those indexed fields from the XML.  Any pointers you could give me (that I would pass on to the programmer) for how to parse data from fields with indexed names like these?  I know just a little about what he is trying to do.  He said he is using a third-party DLL called iTextSharp for the parsing.  If any pointers come to mind on what he might do, please let me know.
    Thanks,
    Emily

    When design Adobe forms, you can have multiple fields with same name; as you mentioned your fields can be named as
    CompanyName [0], CompanyName [1], CompanyName [2], CompanyName [3], CompanyName [4], CompanyName [5]
    However when the form is submitted the form data (in the form of XML) would look like as follows:
    <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
        <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
            <xfa:data>
                <form1>
                        <page1>
                                  <yourSubform>
                                           <CompanyName>My Company 1</CompanyName>
                                            <CompanyName>My Company 2</CompanyName>
                                            <CompanyName>My Company 3</CompanyName>
                                            <CompanyName>My Company 4</CompanyName>
                                            <CompanyName>My Company 5</CompanyName>
                                            <CompanyName>My Company 6</CompanyName>
                                  </yourSubform>
                        </page1>
                </form1>  
            </xfa:data>
        </xfa:datasets>
    </xdp:xdp>
    Note that all the CompanyName fields are named without any indexing.
    If you explain this format to your programmer, he will be able to understand and write a logic to retrieve all CompanyName field's values.

  • How to parse data from a text file with no convenient delimiters?

    I need to read data from a text file.  This file contains one line of data with the repeating pattern "time 00 ADVar2: ___ Height: ____ time 01 ADVar2: ___ Height: ___ ..."  I need LabView to parse out the "time" and "height" values, build an array with the values, and graph the correlation on an X&Y plot.  Does Labview have an automated way to read to the input data file and parse out the correct values, even without convenient delimiters?  Thank you.

    You actually do have a convenient delimiter: "time". Thus, you can make an array using that as the delimiter. Only caveat is that the first array element will be empty. Then you can conveniently use the Scan From String function in a for-loop. Something like this:
    Message Edited by smercurio_fc on 11-21-2008 03:13 PM
    Attachments:
    Example_VI.png ‏9 KB

  • How to read and write data from json file from windows phone7 app

    Hi
    I am developing wp7 app for the use of students my questions are
    How can i write a code to read and write the json/text file for the wp7.
    I am using windows 7 OS, VS 2010 Edition.
    This is my code below:
    xaml:
    <Grid>
                        <TextBlock Height="45" HorizontalAlignment="Left" Margin="7,18,0,550" Name="textBlock1" Text="Full
    Name: " />
                        <TextBox Width="350" Height="70" HorizontalAlignment="Left" Margin="108,1,0,0" Name="txtName"
    Text="Enter your full name" VerticalAlignment="Top" />
                        <TextBlock Height="45" HorizontalAlignment="Left" Margin="6,75,0,0" Name="textBlock2" Text="Contact
    No: " VerticalAlignment="Top" />
                        <TextBox Width="350" Height="70" HorizontalAlignment="Left" Margin="108,61,0,480" Name="txtContact"
    Text="Enter your contact number" MaxLength="10" />
                        <Button Content="Register" Height="72" HorizontalAlignment="Left" Margin="10,330,0,0" Name="btnRegister"
    VerticalAlignment="Top" Width="190" Click="btnRegister_Click" />
                    </Grid>
    xaml.cs:
    private void btnRegister_Click(object sender, RoutedEventArgs e)
                string name, contact;
                name = txtName.Text;
                contact = txtContact.Text;
                try
                    if (name != "" && contact != "")
                        string msg = name + " " + contact;
                        MessageBox.Show(msg);
                        Student stud = new Student
                            Name= name,
                            Contact = contact,
                        string jsonString = JsonConvert.SerializeObject(stud);
                        MessageBox.Show(jsonString);
                    else
                        MessageBox.Show("Input Proper Information", MessageBoxButton.OK);
                catch (Exception ex)
                    MessageBox.Show(ex.Message);
    I have download NewtonSoft.json version 5.0.8.
    So, I am able to convert input data into json format, but how can I able to write and read this data from a json/text file.
    How can I do?
    Thank you in adv and please, reply soon.

    We don't have many samples left for Windows Phone 7 + Azure, the closest one to what you want to do is probably:
    Using Local Storage with OData on Windows Phone To Reduce Network Bandwidth
    this sample uses the local database feature: 'LINQ to SQL', available to Windows Phone 7.1 and 8.0 Silverlight applications, instead of simple file storage but even if you choose to stick with simple file storage I believe you should be able to adapt the
    networking related portions of the sample to your particular application.
    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast
    your votes for existing suggestions.

  • Data from SOAP response not getting into Flex object

    I'm trying to get data from an ALM application we use(Collabnet TeamForge) using a SOAP webservice, and am running into a problem.  I should mention that I am new to both Flex, and webservices.
    I used the "Import Web Services" option in Flex Builder 3, and had it generate code for all operations in the WSDL.  Some of them work just fine.  However, there are several where the data from the SOAP response does not get into the Flex object. The senario that doesn't work is when the response contains a data type that extends another datatype.  In TeamForge, they have a type called TrackerSoapRow.  It extends FolderSoapRow, adding 3 fields.  The problem seems to be that in the response from TeamForge, the 3 fields defined in TrackerSoapRow are in the middle of the fields defined in FolderSoapRow.  I've debugged into it, and the problem occures in mx.rpc.xml.XMLDecoder.getApplicableValues( starting at line 2204 of XMLDecoded.as).  As I read the code, the only way a match can be found is if the fields in the response are in the exact same order as in the definintion.  When its processing the extended data type(  by a call to XMLDecoder.decodeComplexExtension ) at some point, one of the derived type's fields is encountered, and the process stops.
    I have called the service using soapui and verified that all the data I expect is in the response.
    As I mentioned, I'm new to web services.  So, I suppose its possible that the format of the data being returned from TeamForge is incorrect.  That they are not supposed to intermingle base and derived fields.  If thats the case, then I need to report this as a bug to Collabnet.
    All help is appreciated.
    Marc Robertson

    Not knowing any of the details about how you call a web service from OAF myself - I'd suggest you post on the proper forum for OA Framework questions: {forum:id=210}
    John

  • Generate LabVIEW data from JSON

    Hello,
    I have a question about using the "Unflatten from JSON" function in LabVIEW. I have a JSON string data coming from an external application (Java) and I need to convert that to LabVIEW data type (a cluster) and use that information in my program. But the "Unflatten from JSON" function needs a data type to conver the JSON string to LabVIEW data. If I don't know about the data type, is there a way to create a LabVIEW data cluster from the incoming JSON string? Anybody has any experience on this?
    I appreciate all your inputs.
    Thanks...

    Try the JSON LabVIEW library.

  • Is there a way to combine data from multiple responses (collected from different forms)?

    Since FormCentral (FC) doesn't support XFA-based dynamic forms (utilizing form logic), we have a long form that we may need to separate out into smaller PDF forms.  However, the data from each form needs to remain as a group. Wondering if there's a way to combine data form individual forms using FC, or maybe simple solution after-the-fact. I presume there would have to be some sort of unique identifier on each form as a reference.
    NOTE: These are PDF forms imported into FC, not web forms created in FC.

    Hi;
    There are not any methods that FormsCentral provides.  You would not be able to combine it within FormsCentral, you can experiment with exporting the data from FormsCentral to Excel and then combining in Excel.
    Thanks,
    Josh

  • Parsing data from Serial Port one byte at a time

    Hi everyone,
            What I want to do is read in from the serial port byte by byte and parse each byte that I am reading in. The size of the data read in varies. How do I do that? I can do using .dll but I want to learn how to do it in labview. I searched through the forum for something similar but no luck. I have seen some that puts the VISA read in a while loop and others that puts the property node,  "bytes at Port" in a while loop. What is the difference in doing either way? I am using Labview 7.1 Can anyone point me in the right direction?
    Thanks

    Hi guys..
    I'm still a beginner in using labview tcp/ip function. for now, i have a project to read the labview data with java programming language so that i can monitor that data using any devices that using java, such as PC or cell phone. my task for now is to determine the format of data that being sent (its type, length, etc), coz as far as i done until now, the data that read in the java is still a raw material so that i dont know how to gain the information from that data.
    my question is :
    - how does the type cast work in changing the data format from one to another?
    - how does the bytes to read in tcp read work? coz when i'm changing the length of bytes to read constant from 4 bytes to another, the data is becoming mess up. As far as i know, the bytes to read only read the first "constant number" byte in the tcp read to determine the length and type of the data..
    thanks

  • Parsing data from a BLOB

    I am relatively new to oracle, however I've been working with other databases for years.
    I would like to load a csv file into a blob record and then parse that record to populate a separate table.
    Ideally I would use Applications Express to allow a user to upload the file then trigger a procedure to parse the file.
    It seems that the simplest approach to this is to call SQL*Loader and direct the blob to be the input to SQL*Loader but
    I can't find if this is possible or how to do it. I'm open to other approaches however my choice to upload to a blob file in the first place is have access to the original file when necessary and to avoid having hundreds of unorganized file system files.
    The csv file is a simple 3 field file that may typically contain anywhere from a dozen records to 1,000 records.
    The resulting parsed records would then be filled with additional information from cross referenced tables.
    The csv file is created by a hand held data collector and used to create orders for a chain of retail stores.
    Suggestions?

    Hello,
    the blob gives a length of 61, but the inputStream image cannot give a size by available(). I am stuck here. Please help,
    walter
    try{
    pstmt = conn.prepareStatement("SELECT " +
    "aggraph " +
    "FROM antigenic_t "+
    "WHERE agid = ?");
    pstmt.setString(1, refid);
    rset = pstmt.executeQuery();
    if(rset.next()){             
    Blob blob = rset.getBlob("aggraph");
    log.info("BLOB length @@@@ ---> :" + blob.length());
    image = blob.getBinaryStream();
    log.info("inputStream length @@@@ ---> :" + image.available());
    }

  • ABAP Client proxies: extract data from the response and update Z table

    Hi All,
    I have following ABAP code for client proxies:
    We have DT_Req, MT_Req, DT_Res, MT_Res and MI_Sync_OB (O/p Message: MT_Req, I/P message:MT_Res)
    Proxy Objects generated:
    ZCO_MI_SYNC_OB
    ZMT_REQ
    ZDT_REQ
    ZDT_REQ_RECORDS
    ZDT_REQ_RECORDS_TAB
    ZMT_RES
    ZDT_RES
    ZDT_RES_RECORDS
    ZDT_RES_RECORDS_TAB
    ABAP Code:
    REPORT ZTEST_DELETE.
    DATA:
    lo_history TYPE REF TO ZCO_MI_SYNC_OB,
    lo_sys_exception TYPE REF TO cx_ai_system_fault,
    Structures to set and get message content
    lv_history_req_mt TYPE ZMT_REQ OCCURS 0 WITH HEADER LINE,
    lv_history_res_mt TYPE ZMT_RES,
    lv_history_req_rec TYPE ZDT_REQ_RECORDS,
    lv_history_res_rec TYPE ZDT_RES_RECORDS.
    lv_history_req_rec-VLAUE = SY-DATUM.
    APPEND lv_history_req_rec TO lv_history_req_mt-MT_REQ-RECORDS.
    CREATE OBJECT lo_history.
    TRY.
    Call outbound Proxy
    CALL METHOD lo_history->execute_synchronous
    EXPORTING
    output = lv_history_req_mt
    IMPORTING
    <b>input = lv_history_res_mt.</b>
    Error handling
    CATCH cx_ai_system_fault INTO lo_sys_exception.
    SKIP 2.
    WRITE:/ lo_sys_exception->errortext.
    RETURN.
    ENDTRY.
    <b>Now I have my response data in the internable "lv_history_res_mt-MT_REQ-RECORDS" which is deep structure.
    How do I extract data records (multiple) from the above internal table and update to Z table??</b>
    Thanx
    Navin

    Hi Navin,
    go to SPROXY, flag structure and search for your table definition. You will find a table definition a field "line" or something, where you find the right structure. Create a new structure with DATA: myStructure type tableStructure. Define a second structure type with your Ztable. Next Loop at internal table into the structure. Inside that loop fill the Zstructure. Insert the Zstrucure (Press F1 on insert to have the syntax you need)
    loop at internalTable into intStructure.
    zstructure-myField = intStructure-myField.
    INSERT ztable FROM zstructure.
    endloop.
    Regards,
    Udo

  • Error in parsing data from instrument i/o assistant

    I have used a GPIB card to talk with a HP53131 Counter. I tested the command in the Instrument IO Assistant, the data it reads back is good and never show a problem. But when I link output to text pallet or a chart, the data is wrong. I should get 5e6, it gives me 5e66. I can fix this by put a division in to data pipe-line. But the labview program has other errors too. for about 10-15% of the probability, Instrument IO Assistant outputs very high or low numbers like 55e66, or 0. Also fairly high interuption due to "GPIB scaning errors" (no less than 5% probability). Does anybody know such bugs from Instrument IO Assistant?
    I used the same hardware and HP provided software in Excell. It can contiue take data for 1 wee
    k and does not break. No error readings.
    Thanks in advance
    Regards
    James

    Tommy,
    In the parsing window, I see the right number. But when it sends it out to other VIs, the number is wrong. I tested the assistant many times, I did not catch the error I saw outside. The VIs I used to check the Asistant are:chart, array (saved to file) and text box. All show the same wrong number if one does.
    Attached is the VI I used to test and some saved data after divided by 1e60
    Attachments:
    hp53131a_test2.vi ‏133 KB
    nitestdata.txt ‏2 KB

  • Cannot parse data from xml

    I am trying to obtain strings from a xml file:
    I tried the following:
    var url:URLRequest = new URLRequest("blog.xml");
    var xml:XML;
    var rss:URLLoader = new URLLoader();
    rss.load(url);
    rss.addEventListener(Event.COMPLETE, readRss);
    function readRss(e:Event):void{
           xml = XML(rss.data);
           txt_field.text=xml.entry[1].author.name;
    but had no results. TypeError: Error #1010:...
    I tried tracing xml and that worked fine.
    The xml structure seems to be too complex
    var blogList:XMLList = xml.children(); //returns a more simple xml structure but still no success in parsing parts of the xml such as "title" or "author".
    Any suggestions would be greatly appreciated.
    Thanks

    Hi Kglad,
    thank you for helping me with this post and all the previous threads.
    for accessing entry[1].title, i tried:
    xml..ns::entry[0].title // but didn´t really work.
    I also tried to retrieve all the items under "entry" with:
       var ns:Namespace=xmlData.namespace();
       var MSGCounter:int = 1;
       for each (var item:XML in xmlData..ns)
        txt_field.appendText("Post "+MSGCounter++ +"\n")
        txt_field.appendText("------------------------------------------------------------------- -----\n");
        txt_field.appendText(item.entry.title.toString());
        txt_field.appendText("\n");
        txt_field.appendText("\n");
        txt_field.appendText(item.entry.content.toString());
        txt_field.appendText("\n ");
        txt_field.appendText("\n ");
        txt_field.appendText(item.entry.author.name.toString());
        txt_field.appendText("\n\n");
    but had no success.

  • How to parse data from XML with prefix?

    Hi folks,
    I have an XML which tags include prefixes. I would like to parse it using a select. Any ideas?
    [Sample XML|http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_or.cgi?ico=46972501]
    I tried this:
    select xml
    from
       (  select
                httpuritype('wwwinfo.mfcr.cz/cgi-bin/ares/darv_or.cgi?ico=46972501').getXML() xml
          from dual
        );This just returns XML.
    select  x.ico,
            x.org_name
        from dual d
             ,XMLTABLE('/are:Ares_odpovedi/are:Odpoved/D:Vypis_OR'
                        PASSING httpuritype('http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_or.cgi?ico=46972501').getXML()
                        COLUMNS
                           ico varchar2(50) PATH 'D:ZAU/D:ICO'
                          ,org_name varchar2(200) PATH 'D:ZAU/D:OF'
                        )  x
       where rownum = 1
    ORA-19228: XPST0008 - undeclared identifier: prefix 'are' local-name 'are:Ares_odpovedi'Any idea how to simply get all details into columns?
    Thanks,
    Tomas

    add xmlnamespaces to xmltable
    select  x.ico,
            x.org_name
        from XMLTABLE(
             xmlnamespaces('http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3' as "are"
             , 'http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_datatypes/v_1.0.3' as "D"),
             '/are:Ares_odpovedi/are:Odpoved/D:Vypis_OR'
                        PASSING httpuritype('http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_or.cgi?ico=46972501').getXML()
                        COLUMNS
                           ico varchar2(50) PATH 'D:ZAU/D:ICO'
                          ,org_name varchar2(200) PATH 'D:Vypis_OR/D:ZAU/D:OF'
                        )  x
       where rownum = 1not tested

Maybe you are looking for

  • (on the web) can preview be removed/stopped until the message opened?

    I'm running 10.5 and "the cloud" will not supress the preview portion/display so I can quickly move through my mail! ...Especially when I have to go to the library to access mail - MS-esplorer is very slow to respond/access the cloud and the cloud fr

  • Table only showing some borders

    HI, I'm new to dreamweaver although have mucked around a bit with MX. I now have CS3 and I'm going crazy over this one problem. ( at the moment anyway) I have a table with 3 rows and 3 columns. A lovely double border shows around each cell in design

  • Location wise authorization to user

    Hi my client is using account segmentation. it has diffrent users at diffrent locations. the server is at head office. the client does not want that the user at diffrent location could see the ledgers, business partners any thing related to user of o

  • Any difference in operating systems

    I am looking to buy a macbook pro, I am currently living in South Korea but I am Irish, is there any differences in the software between the two countries.

  • Issue related to Alerts ;urgent

    Hi Folks, I am facing a issue in alerts: <b>I want to capture all types of exceptions via alert messages in alertinbox .</b> <b>Kindly let me know any prerequisites for this...?</b>, Like do i need to configure any SMTP ...etc I have created alert ca