JSON - Array input

http://krisrice.blogspot.com/2013/02/restful-templates-and-binds.html
Kris's blog post above describes how to use binds in RESTful templates in ORDS. The last part says that when a simple JSON string is POSTed to the template, it is automatically converted into bind variables for the PL/SQL to use.
Question: If we need to supply a complex dataset to the POST handler (e.g. say a web form with both scalar values and multiple nested values), I was wondering if it also accomodates a JSON array e.g.
{"collection_id":"1234",
  "members":
     {"firstName":"John", "lastName":"Doe"},
     {"firstName":"Anna", "lastName":"Smith"},
     {"firstName":"Peter", "lastName":"Jones"}
If so, any ideas on how to support this? Of course, the underlying PL/SQL code needs to accept arrays as input parameters.
Any thoughts, examples, ideas much appreciated. Thanks

You will have to use something like PL/JSON to parse the text programatically.  It's found here https://github.com/pljson/pljson
They have a bunch of examples as part of the library here : https://github.com/pljson/pljson/tree/master/examples
-kris

Similar Messages

  • Error from array input

    I'm using a DBL array input so the user can set several values.
    Now I recognized an error: When the user inputs "0", the VI gives
    me a ~"-1E-12", this leads to an error message as I do some range
    checking... What's wrong?
    This only occurs, when the user manually inputs values. When I preset
    the array with values loaded from a config file, everything works fine.

    Well, how to add an attachment, when you use www.google.com to post
    messages? If somebody wants to have an example vi, send me an email!
    I try to explain: this vi is part of the inputs & configuration vi's
    of a bigger measurement program (+100 vi's).
    It get's its predefined values from global variables. Then it copies
    these globals to the local controls. The user can change/add/delete
    values in these controls (in this case an array input) and when he/she
    is ready, he/she just presses an ok-button. Then the vi does a range check
    and when all is ok, the values from the local array input is copied
    back to the global variable.
    The problem now: Normally the user loads a config file, all values are
    read and copied into the global variables. Then the user is force
    d to
    check all values in those configuration-vi's by pressing "Ok" in every
    sub-vi and everything is ok. But the last time I didn't use a config file
    and tried to input all the values from the configuration vi's. That's
    when I noticed this misbehavior: I tried to input a "0", but the vi
    thought of getting ~"-1E-12" (found out via debugging mode).
    Any help/advice?
    JRA wrote in message news:<[email protected]>...
    > Gerd, this may help if you could paste a VI which exhibits this
    > behavior in this discussion. I'm not quite sure what you are seeing
    > yet. Attach an example to a message and we will take a look at it.

  • Find maximum in array inputs

    Dear All,
    I would like to find and replace the highest value among a set of values being polled.  I only manage to find the highest value if i compare the new value with the old value using a shift register with a single value (element) only.
    Right now, if i am dealing with array inputs instead of single value, how should i do it?
    Example:
    New Input1=[5
                         4
                         3
                         2
                         1]
     Input 2= [  4
                       3
                       5
                       3
                       3]
     Therefore the answer should be  x=  [5
                                                             4
                                                             5
                                                             3
                                                             3]
    Then if another new input array has higher values then x, the answer will again be modified.The values are compared by row versus row of each elements in the array. The final answer should be in array form.
    Can anyone help out with this? Thank you so much!
    Solved!
    Go to Solution.

    One way, this is the first one that jumped to mind. May be an easier one out there.
    Message Edited by for(imstuck) on 04-22-2010 10:37 AM
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    array compare.PNG ‏6 KB

  • Transforming ABAP internal table to JSON array (rather than object)

    Is there an easy way to do this using the standard CALL TRANSFORMATION?  Here's what I'm doing:
    "ABAP to JSON
       writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
       CALL TRANSFORMATION id SOURCE ARRAY = lt_table
                              RESULT XML writer.
       lv_json = writer->get_output( ).
    Now this generates JSON with an object named ARRAY in the proper format with sub-objects... but I don't want an object named ARRAY, I just want an unnamed array.
    I searched through the documentation, the asJSON documentation seems to imply this should be possible, but doesn't specify any way to accomplish such a thing.  Leaving the name blank just generates an error.
    Tried a few transformation OPTIONS as well, but none of them seem to accomplish this.
    It's not a huge deal to use an object instead (although we're trying to squeeze every microsecond of performance out of this call), or even to just write my own darn transformation, but I guess I'm surprised SAP doesn't seem to support this functionality with CALL TRANSFORMATION.  Am I missing something?  Please tell me I'm missing something

    I honestly can't remember why I asked this question (I think I was just confused about why the object needed a name but that turned out to not really be a problem), but here's what I ended up doing, in case it's helpful:
    EDIT: I noticed above someone asked about uppercasing the JSON -- I also had to do this because the REST service I was calling required it.  You can see below I actually convert back to string to do this, though there may be a more elegant solution.
    *for call to cl_http_client=>create_by_destination
       constants:  lc_dest    TYPE rfcdest  value 'MILEMAKER'.
    *local structures for handling input/output
       DATA: ls_postal_dist type ZST_POSTAL_DIST,
             ls_postal_conv type ZST_POSTAL_DIST,
             lt_postal_conv type ZTT_POSTAL_DIST,
    *for call to cl_http_client=>create_by_destination
             lo_CLIENT type ref to IF_HTTP_CLIENT,
             ls_RANDMCNALLY_JSON type ZST_RANDMCNALLY_JSON,
             lt_RANDMCNALLY_JSON type table of ZST_RANDMCNALLY_JSON,
             lv_HTTP_REASON type string,
             lv_HTTP_CODE type i,
    *JSON conversion
             lo_writer TYPE REF TO cl_sxml_string_writer,
             lv_json_in TYPE xstring,
             lv_json_out TYPE xstring,
             lv_json_string type string,
             lo_conv  type ref to CL_ABAP_CONV_IN_CE,
             lo_conv2 type ref to CL_ABAP_CONV_OUT_CE,
    *return parameters and error handlers
             lo_cxroot   TYPE REF TO cx_root,
             lv_message type string,
             lv_PAR1 LIKE  SY-MSGV1,
             lv_PAR2 LIKE  SY-MSGV2,
             lv_PAR3 LIKE  SY-MSGV3,
             ls_return type bapiret2.  "return structure
    [snip]
    *set request parameters
           CALL METHOD lo_client->request->SET_CONTENT_TYPE('application/json').
           CALL METHOD lo_client->request->SET_METHOD('POST').
    *convert data to JSON
           lo_writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
           CALL TRANSFORMATION id SOURCE routes = lt_RANDMCNALLY_JSON initial_components = 'suppress' RESULT XML lo_writer.
           lv_json_in = lo_writer->get_output( ).
    *attach data to body
           CALL METHOD lo_client->request->SET_DATA
             EXPORTING
               data = lv_json_in.
    *get JSON text in string format for testing
           CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
             EXPORTING
               INPUT       = lv_json_in
               ENCODING    = 'UTF-8'
               REPLACEMENT = '?'
               IGNORE_CERR = ABAP_TRUE
             RECEIVING
               CONV        = lo_conv.
           CALL METHOD lo_conv->READ
             IMPORTING
               DATA = lv_json_string.
    *send HTTP POST call to RandMcNally webservice
           call method lo_client->send
    * exporting  timeout = lc_timeout
            exceptions http_communication_failure  = 1
            http_invalid_state = 2
            http_processing_failed = 3
            others = 4.
           if sy-subrc <> 0.
             CALL METHOD lo_client->get_last_error
               IMPORTING
                 message = lv_message.
             CONCATENATE 'HTTP POST:' lv_message into lv_message.
             move lv_message to ls_return-message.
             append ls_return to return.
           endif.
    *receive data back
           CALL METHOD lo_client->receive
             EXCEPTIONS
               http_communication_failure = 1
               http_invalid_state         = 2
               http_processing_failed     = 3
               others                     = 4.
    *pass errors back, if any
           if sy-subrc <> 0.
             clear ls_return.
             ls_return-type = 'E'.
             CALL METHOD lo_client->get_last_error
               IMPORTING
                 message = lv_message.
             move sy-subrc to lv_json_string.
             CONCATENATE 'RECEIVE DATA:' lv_json_string lv_message into ls_return-message SEPARATED BY space.
             append ls_return to return.
           endif.
    *get the data (a table in JSON format) from response object
           clear lv_json_out.
           lv_json_out = lo_client->response->GET_DATA( ).
    *get the status of the response
           CALL METHOD lo_client->response->GET_STATUS
             IMPORTING
               CODE   = lv_HTTP_CODE
               REASON = lv_HTTP_REASON.
    *if response status code not 200 (OK), return error and cease processing
           if lv_http_code <> '200'.
             clear ls_return.
             ls_return-type = 'E'.
             move lv_http_code to lv_json_string.
             CONCATENATE 'GET STATUS:' lv_json_string lv_HTTP_REASON into ls_return-message SEPARATED BY space.
             append ls_return to return.
           ENDIF.
         catch cx_root into lo_cxroot.
         cleanup.
           ls_return-message = lo_cxroot->get_text( ).
           append ls_return to return.
       endtry.
    *close channel
       CALL METHOD lo_client->close
         EXCEPTIONS
           http_invalid_state = 1
           others             = 2.
    *trying to process after error sometimes results in short dump because lv_json_out contains something other than JSON
       if ls_return is not initial.
         return.
       endif.
       if lv_json_out is not initial.
    *convert JSON to string and make it UPPERCASE so that SAP can do transformation
         CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
           EXPORTING
             INPUT       = lv_json_out
             ENCODING    = 'UTF-8'
             REPLACEMENT = '?'
             IGNORE_CERR = ABAP_TRUE
           RECEIVING
             CONV        = lo_conv.
         CALL METHOD lo_conv->READ
           IMPORTING
             DATA = lv_json_string.
         TRANSLATE lv_json_string to UPPER CASE.
    *convert JSON back to xstring
         CALL METHOD CL_ABAP_CONV_OUT_CE=>CREATE
           EXPORTING
             ENCODING    = 'UTF-8'
             REPLACEMENT = '?'
             IGNORE_CERR = ABAP_TRUE
           RECEIVING
             CONV        = lo_conv2.
         lo_conv2->convert( EXPORTING data = lv_json_string
                      IMPORTING buffer = lv_json_out ).
    *convert our now UPPERCASE xstring to output table (JSON to ABAP)
         clear lt_randmcnally_json.
         lo_writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
         CALL TRANSFORMATION id OPTIONS value_handling = 'accept_decimals_loss'
                                SOURCE XML lv_json_out
                                RESULT routes = lt_RANDMCNALLY_JSON.
    [snip]

  • Help with 2D array input using a text file

    I'm writing a JAva program using BlueJ, which requires me to read info from a text file and put them into an 2D array. I got this error msg and I couldn't gifure out how to fix it. Please help me. Thanks a lot. The program is due tomorrow, please help.
    Error message:
    NoSuchElementException:
    null(in Java.util.StringTokenizer)
    Here's the program with the line where the problem is highlighted
    import java.io.*;
    import java.util.StringTokenizer;
    public class ***
    // Reads students' test scores from a file and calculate their final grade
    public static void main (String[] args) throws IOException
    String file1 = "C:/Temp/scores.txt";
    int[][] input = new int[25][5];
    StringTokenizer tokenizer;
    String line;
    FileReader fr = new FileReader (file1);
    BufferedReader inFile = new BufferedReader (fr);
    line = inFile.readLine();
    tokenizer = new StringTokenizer (line);
    for (int row = 0; row < 25; row++)
    for (int col = 0; col < 5; col++)
    input[row][col] = Integer.parseInt(tokenizer.nextToken()); --> porblem
    This is what the text file looks like:
    1 74 85 98
    2 97 76 92
    3 87 86 77
    4 73 85 93
    5 99 99 83
    6 82 84 95
    7 78 83 91
    8 84 79 84
    9 83 77 90
    10 75 78 87
    11 98 79 92
    12 70 73 95
    13 69 80 88
    14 81 77 93
    15 86 72 80
    16 70 76 89
    17 71 71 96
    18 97 81 89
    19 82 90 96
    20 95 85 95
    21 91 82 88
    22 72 94 94

    Try this code..(I've tested this code in my machine and it works fine)
              try {
                   FileReader fileReader = new FileReader("Z:\\fileInput.txt");
                   BufferedReader reader = new BufferedReader(fileReader);
                   int[][] fileData = new int[22][4];
                   StringTokenizer tokenizer = null;
                   String line = reader.readLine();
                   int rowCount = 0;
                   while(line != null) {
                        tokenizer = new StringTokenizer(line, " ");
                        int columnCount = 0;
                        while(tokenizer.hasMoreTokens()) {
                             fileData[rowCount][columnCount] = Integer.valueOf(tokenizer.nextToken()).intValue();
                             columnCount++;
                        line = reader.readLine();
                        rowCount++;
                   fileReader.close();
                   System.out.println("Done");
              } catch (FileNotFoundException fnfe) {
                   System.out.println("File not found " + fnfe);
              } catch (IOException ioe) {
                   System.out.println("IO Exception " + ioe);
    The problem with your code is that you should first check whether there are any tokens before doing nextToken().
    -Amit

  • Object array input

    Hello, I am trying to input a file that contains an array of object refrences. When doing so I set the array to receive the input array to a larger size than the array being input. Once the array is input however, it resizes the created array to the size of the input array. For instance, I create an array size 10. Input and array size 5. The length of the created array will now be 5. I caught it by using this check:
    System.out.println(shapes.length);
    shapes = (MyShape[]) objectIn.readObject();
    System.out.println(shapes.length);
    Any help would be appreciated.
    Thanks,
    Matt

    Hello, I am trying to input a file that contains an
    array of object refrences. When doing so I set the
    array to receive the input array to a larger size
    than the array being input.How do you know it's larger than what's being input? It might be better to use (for example) a Vector so that the array grows automatically as you add items.
    Once the array is input
    however, it resizes the created array to the size of
    the input array. For instance, I create an array
    size 10. Input and array size 5. The length of the
    created array will now be 5. I caught it by using
    this check:
    System.out.println(shapes.length);
    shapes = (MyShape[]) objectIn.readObject();
    System.out.println(shapes.length);It's a bit unclear what your problem is... can you post more code and/or errors?

  • Arrays to 3D-cluster arrays input Feed into draw Mesh

    Hi,
    I'm puzzzle with my own algorithm.
    I want to grab input then feed into 3D-cluster array . then feed into Mesh parameters array.
    The problem i had, I want to take 2 rows, feed into 3D-cluster, then send into mesh parameter,
    then redo it with another 2 rows moving down the array.
    So i will have 1 line that "move" in the 3D picture control
    Attached is my vi.
    Attachments:
    array-problem.JPG ‏72 KB

    Sorry here the VI ..   
    Attachments:
    moving3D-data work3.vi ‏18 KB
    zulhairi_1.csv ‏71 KB

  • Labview Calling DLL with 2D array input and output

    Hi all,
        I have to call  a dll which a 2D double array as an input and also a 2D double array as an output.The dll is made by me and written in c language , I need it to work  efficiently.
    If i define the program in labview like this
    The 2 2Darrays sent into CLN were "Array data pointer",then how to define the function in c laguage? just like  -----int  myfunction (Parameter1,Parameter2,Parameter3,Parameter4)
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.

    ylongwu wrote:
    If the function in the dll is defined like this         int myfunction (double  **A, int sx,int sy ,double **B,int ix,int iy),then what will the program in labview will be ?
    sx ,sy ix ,iy are the array's size.
    Your proposed prototype double ** seems to indicate that you want an array of pointers to the rows of the array. That is not how LabVIEW stores multidimensional arrays (nor how this is usually done in C for such arrays).
    LabVIEW and most C libraries threat multi dimensional array as one single block of memory where the rows are located one after the other. So as DFGray has already pointed out you should use double * instead as datatype or since you create the DLL yourself and if it doesn't need to be compatible with other environments than LabVIEW change that altogether into:
    typedef struct {
       int32 dimSize1;
       int32 dimSize2;
       double elm[1];
    } 2DDblArrRec, **2DDblArrHdl;
    int myfunction (2DDblArrHdl A, 2DDblArrHdl B);
    then change the Call Library Node parameters for the arrays to pass the array as Data Handle (the native LabVIEW datatype) and leave away the extra dimensions since they are already inside the handle structure.
    Last but not least if you want to be very fancy you can even use NumericArrayResize() on the output handle to resize it to the correct size before filling in your information and leave away the Initialize Array function on the LabVIEW diagram.
    Message Edited by rolfk on 05-26-2010 09:11 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • JSON arrays vs. properties

    I'm finding that a JSON response from Raylight may or may not be an array depending on whether there are multiple items.  For example, a WebI doc with multiple reports will produce this:
      "reports": {
        "report": [
            "id": 2,
            "name": "Report 1",
            "reference": "2.RS",
            "showDataChanges": false
            "id": 1,
            "name": "Report 2",
            "reference": "1.RS",
            "showDataChanges": false
    Whereas if there is only one report tab, the result is:
      "reports": {
        "report":  {
            "id": 2,
            "name": "Report 1",
            "reference": "2.RS",
            "showDataChanges": false
    This is a problem, since the report property must be accessed differently.  With JQuery, if "report" is an array, I can access the individual reports with:
    $.each(json.reports.report,function() { $(this).id });
    But the code doesn't work if there is only one report -- it returns the properties of the "report" property instead of report itself.  Instead, I have to do:
    json.reports.report.id
    So, is there any code that can access the "report" properties whether or not it's an array?

    When we have arrays in java, why did they provide
    arraylist? What is the basic advantage of ArrayList
    over Array?
    Thanks in advanceLook at the API that would answer your question. All the functionality available for Arraylist is it available for arrays as well.
    It is very similar to asking why have String class when you can have an array of chars.
    Sun is just trying to make your life easy

  • DAO in Websphere calling Oracle SP with array input params

    Hi,
    We have a complex Oracle stored procedure which gets called by the DAO in Websphere 5.1.
    The stored procedure takes couple of input array.
    Code snippet -
    CallableStatement cstmt = con.prepareCall("{call pkg_name.ap_name( ?,?,?,?,?,?,?,?,? )}");
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("STRING_VARRAY", con);
    ARRAY arr1 = new ARRAY(desc, con, strArray);
    cstmt.setArray(1, arr1);
    I get this exception when trying to create Oracle array desciptor -
    java.lang.ClassCastException: com/ibm/ws/rsadapter/jdbc/WSJdbcConnection incompatible with oracle/jdbc/OracleConnection
    How can I get a OracleJdbcConnection object from WSJdbcConnection?
    Is there any way to do this using the WS Jdbc classes?
    Is there any other way to pass an array to a callable statement?
    TIA.
    - vineet

    Hi,
    We have a complex Oracle stored procedure which gets
    called by the DAO in Websphere 5.1.
    The stored procedure takes couple of input array.
    Code snippet -
    CallableStatement cstmt = con.prepareCall("{call
    pkg_name.ap_name( ?,?,?,?,?,?,?,?,? )}");
    ArrayDescriptor desc =
    ArrayDescriptor.createDescriptor("STRING_VARRAY",
    con);
    ARRAY arr1 = new ARRAY(desc, con, strArray);
    cstmt.setArray(1, arr1);
    I get this exception when trying to create Oracle
    array desciptor -
    java.lang.ClassCastException:
    com/ibm/ws/rsadapter/jdbc/WSJdbcConnection
    incompatible with oracle/jdbc/OracleConnection
    How can I get a OracleJdbcConnection object from
    WSJdbcConnection?
    Is there any way to do this using the WS Jdbc
    classes?
    Is there any other way to pass an array to a callable
    statement?
    TIA.
    - vineetI am experiencing the same ClassCastException when creating an ArrayDescriptor. It occurs on execution the following line of code:-
    oracle.sql.ArrayDescriptorarrayDesc = oracle.sql.ArrayDescriptor.createDescriptor(schema + "." + table, conn);
    Java Context: Stateless EJB
    J2EE Version: 1.3
    JRE Version: 1.4.2
    EJB Version: 2.0
    J2EE Container: WebSphere v5.1.1.2, build number cf20446.02
    Container transaction type: Required (for all remote methods)
    Oracle Impl class: oracle.jdbc.xa.client.OracleXADataSource
    Oracle driver file: classes12.zip
    Oracle Version: 8.1.7.4
    Is there a solution to this issue?

  • Arrays, input, string tokenizer

    ConsoleReader console = new ConsoleReader(System.in);
    int count_words = 0;
         boolean done = false;
         while(!done)
         {      String input = console.readLine();
              if (input == null)
              done = true;
              else
         StringTokenizer token = new StringTokenizer(input);
              while (token.hasMoreTokens())
              {      token.nextToken();
                   count_words++;
    String[] list = new String[count_words];
         for (int i = 0; i < 30; i++)
    list[i] i= ((String)(token.nextElement()));
    System.out.println(count_words);
    here is some code i have, i want to convert the tokens read in, and put them into the array, this doesnt work can someone please expand upon this, and help me out,
    thanks
    where it says list i, it should have square braces around it indicating the array, but for some reason they dont show up

    You can replace the whole thing with:
    ConsoleReader console = new ConsoleReader(System.in);
    String input = " ";
    while(input != null) {
         input = console.readLine();
         StringTokenizer token = new StringTokenizer(input);
         String[] list = new String[token.countTokens()];
         for (int x = 0; x < list.length; x++) {
              list[x] = token.nextElement();
         System.out.println(list.length);
    }Rather than reinvent the wheel, use methods that already exist. (It could actually be somewhat simpler, but this keeps the general flow of your original code.) Also, the reason that the square brackets are disappearing is that square brackets surrounding the letter i are used to indicate italics on this forum.
    Mark

  • Suggestion: Macros or a way to unroll loops? Integer array input? Shader Model 3 and 4?

    I think it would be nice if pixel bender supported a way to unroll loops. In it's current state certain shaders are really awkward to write or just get ugly when they're converted for flash player. I know it wouldn't be that hard for the developers to just unroll constant sized loops. Things such as:
    for (int i = 0; i < 10; ++i)
      if (foo) { ... }
    can be unrolled easily. Either that or add in some code generation feature that allows this with a preprocessor system. Or better yet add in support for loops since it only requires shader model 3 or equivelant from GLSL.
    This brings me onto another point. Is there going to be support for Shader Model 4? I'm talking about bitwise operations and integer types. Even if you don't allow native support for byte array adding texture sampling for bytes, shorts, and integers would be nice. Also allowing this to work in flash would be nice with the ability to tell the user they don't have shader model 4 or be able to detect compatability and use a different shader.
    Integer arrays would be nice to allow to as input then to the shader. I noticed the reference manual already mentioned:
    "NOTE: Pixel Bender 1.0 supports only arrays of floats, and the array size is a compile-time constant. Future versions of Pixel Bender will allow arrays to be declared with a size based on kernel parameters, which will enable parameter-dependent look-up table sizes."
    Again support for these features in flash player would be really nice.
    Targetting the lowest GPUs is really limiting the true power of pixel bender. I wrote this for fun: http://assaultwars.com/pictures/raycasting6.png which is just a simple real-time voxel raycaster. However, it could be so much more powerful if pixel bender supported more of the GPUs features. Even simple things like custom functions would be really handy in flash player. I'm thinking of this more oriented toward flash games too where more powerful features are unlocked based on the user's GPU.
    If this is already planned for a future pixel bender release then nevermind. I didn't see a developers blog or any news about future versions.
    Interesting:
    http://forums.adobe.com/thread/36659?tstart=60
    Apparently Kevin said "Look for them in a future version of the language as cards that support  these features become common." in regards to bitwise operators aka Shader Model 4.

    Here's an example, not using NetBeans:
    import javax.swing.*;
    public class TextDemo extends JPanel
        public TextDemo()
            int[] newbinarray = {0, 1, 1};
            StringBuffer sb = new StringBuffer();
            for (int value : newbinarray)
                sb.append(value);
            String st = new String(sb);
            this.add(new JTextField(st));
        private static void createAndShowGUI()
            JFrame frame = new JFrame("TextDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(new TextDemo());
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args)
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createAndShowGUI();
    }

  • Array to cluster fnc drops one of my array inputs?

    Anyone know what may be going on here? Thanks in advance.
    Attachments:
    Read GPS.vi ‏51 KB

    There's a fundamental difference between clusters and arrays. While clusters can have elements of different types in them, the number of elements must be static. It must be known exactly before you press the run button, and it can't change during run-time.
    The Array to Cluster function must therefore know in advance how many elements the cluster will contain. It can't wait until run-time to decide this when it actually gets the number of elements in the input array. The way you specify this in advance is by right clicking the Array to Cluster function and selecting Cluster Size from the shortcut menu. Here you can specify statically how big your cluster will be. The default is 9 elements large. So if your input array had 10 elements, you would lose one element. If your input array has 4 elements, the last 5 elements of the cluster will have default values.
    Jarrod S.
    National Instruments

  • Generic / variable reference to json array field name

    hi -- I have a javascript function that I want to make variable-based, so it can be used throughout my application.
    It creates and parses a json object. I ultimately need to reference a field in that object. The field name is the name of database column
    that was queried in the called application process.
    For example, if the query executed was: select my_id from my_table where my_name = 'the_name', and the object that holds the parsed
    AJAX response is jsonobj, then I need to reference: jsonobj.row[0].my_id
    I don't want my_id to be hardcoded in the reference. Rather, I want to pass the string 'my_id' into the javascript function (let's call
    the variable dest_item_name) and then reference (something like): jsonobj.row[0].<dest_item_name>.
    (How) can I do this? Please tell me I can! :)
    Thanks,
    Carol

    Hmmm, well, I thought I described my goal in the first post... but I'll try again.
    hi -- I have a javascript function that I want to make variable-based, so it can be used throughout my application.
    The function does this:
    ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=LOOKUP_VALUE',0);
    ajaxRequest.addParam('x01', source_item_value); -- equal to 'basin'; this is the value that will be used to lookup the value of dest_column_name
    ajaxRequest.addParam('x02', source_column_name); -- equal to 'my_name'; this is the name of the database table column that will be = 'basin'
    ajaxRequest.addParam('x03', dest_item_name); -- equal to P3_MY_ID; this is the name of the page item that will be set to the returned value
    ajaxRequest.addParam('x04', dest_column_name); -- equal to 'my_id'; this is the name of the table column that gets queried
    ajaxRequest.addParam('x05', lookup_table_name); -- my_data; this is the table to query
    ajaxResponse = ajaxRequest.get();
    if (ajaxResponse) {
    var jsonobj= ajaxResponse.parseJSON();
    $s(dest_item_name, jsonobj.row[0].my_id);
    The goal of this javascript and application procedure is to have a generic method for looking up values
    in the database. In the above example, I want to query my_data to get the value of my_id where my_name = 'basin'.
    The application procedure LOOKUP_VALUE uses the x variables to construct that SQL query. For the above values, the
    returned query is: select my_id from my_data where my_name = 'basin';
    Then I set my dest_item_name (P3_MY_ID) to the value in the parsed json object. But as you can see, if I'm querying a different
    table with different column names, the reference to jsonobj.row[0].my_id won't work, because the database column name
    will be different. I've gotten around this by aliasing the queried field to RETURN_VALUE, so I'm just doing:
    $s(dest_item_name, jsonobj.row[0].rerturn_value); -- which works great.
    But my goal was to somehow be able to reference the variable dest_item_name (which is the name of the queried database
    column) in my $s set statement.
    Possible? If so, I'm sure it could come in handy at some point.
    Thanks,
    Carol

  • Deriving color space of an image from a byte array input stream.

    I was wondering, is it possible to derive the color space of an image, i.e. RGB, YCC, GRAY by calculating its bytes?

    Calculate bytes just means doing operations on the
    byte values. That's how I got the height and width of
    the image. Now, I'm wondering if it is possible for
    the color space.Look at the format specifications...
    By the way, do all image file types have different
    color space or could they all have the same color
    space, for example, RGB?They can have different color spaces. RGB, ARGB, CMYK, some Adobe format...

Maybe you are looking for

  • How do i turn off caps lock/numbe​r lock notificati​on.

    I purchased a computer today and the only thing wrong is the caps lock /number lock notification that pops up in the right hand bottom of the screen. Whenever I press CTRL ATL Delete, the app that is runnning is called, HPKEYBOARD status. I tried to

  • Error showing - No price could be determined for subcontracting in CK11N

    Hi, We are facing a problem in CK11N that while we are creating Material Cost Estimate with Quantity Structure, getting an error message.. No price could be determined for subcontracting Message no. CK468 Diagnosis The system could not calculate a pr

  • Power Mac 5500 hard disk woes...

    I had a PM 5500 but with a faulty HD. I decided to swap in an 800 MB Quantum Trailblazer from a Performa 5200 I had laying around and was met with some success. However I wanted something a little bigger for my purposes so I found a 40 GB Western Dig

  • Expdp unexpected fatal error

    Hello Experts I am trying do a datapump  and I get the error as given below.  I tried to use the  EXCLUDE=STATISTICS clause, but still I get the same error. Please guide me to move forward. Export: Release 11.2.0.1.0 - Production on Thu Nov 14 13:28:

  • Number of 10gR2 instances on a single server

    Good evening, this is my first post here. We want to create several 10gR2 instances (one per application) on a single linux server (Red Hat 4.0). We do not want to create one instance with separated tablespaces or schemas as the editors of the applic