Passing the array in sp

can be pass the array in sp 2005 sql server

RSingh()
Option
two describes the method which is supported only since SQL Server 2008.
@skc_chat
www.projectdmx.com/tsql/sqlarrays.aspx
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • How to pass the array as a hidden variable

    hi im trying to pass the list of employees as an array and pass it to servlet as a hidden variable and retrieve the same array in servlet
    can any one help me in this . urgently required.

    I have created only one
    <input type="hidden" name="empName">
    when the user check the check box i want to add all the values in the empName, click the Next page, Again we show some check box i want to add some more names to the hidden value
    When the user click back i want to show which chekboxes user selected.

  • Passing the array into actionPerformed method

    Hi friends! I am new at java. I made a tictactoe game board with GUI and it is designed according to nxn (desired any n value). When I pressed to any button, it should write an X to my board but I could not passed the button's action. My problem is that my actionPerformed method does not accept array button[j]. In the below there is a part of my code :
    for(int j=0;j<button.length;j++)     // adding the buttons
    button[j].addActionListener(this);
    public void actionPerformed(ActonEvent evt)
    // what can I read here for detecting the right button? button length is changable, it is depent on what we desire at first.
    // I tried this code in this area but it does not work:
    // if (evt.getSource()==button[j])
    // button[j].setText("X");
    // normally, it works if I write every button individually like that:
    // button1.addActionListener(this); (same for other buttons)
    // public void actionPerformed (ActionPerformed evt)
    // if (evt.getSource()==button1)
    // button1.setText("X"); (same code for other buttons)
    // but I want to make a generalized board action
    }I will be appreciated with your helps...
    Musty

    Hi musty4284,
    The getSource method of ActionEvent(not ActonEvent) returns an object and the way you're comparing objects is wrong.
    Theorically, you should do something like this :
    public void actionPerformed(ActionEvent evt) {
        JButton b = (JButton) evt.getSource();
        if ( button[j].equals(b) ) {
    }Edit :
    When using a listener for an array of JButton, it is a good idea to give a unique identifier to each button (for example, their index in the array). The JButton class has a setName method not to confuse with the setText method.
    While building your array of JButton, you can do :
    JButton[] button = new JButton[9];
    for (int i = 0; i < 9; i++) {
        button[i] = new JButton();
        button.setName(i);
    While handling the event :public void actionPerformed(ActionEvent evt) {
    JButton b = (JButton) evt.getSource();
    int index = Integer.parseInt(b.getName());
    button[index].setText("X");
    Edited by: Chicon on Oct 4, 2009 11:20 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help on passing an array to  java routine from PL/SQL

    I got a math routine in java and the idea is have an array of integer and the java routine does some computatoin and then pass the array back to pl/sql
    and I google the web most code is calling pl/sql from java but not the other way round. any help will be really appreciated.
    {code}
    package tst;
    import java.util.*;
    public class plsql3 {
            private final static int factor1 = 2;
            public static void getFib2(int[] in, int[] out, int k){
                            for (int i=0;i<=k-1;i++){
                    out[i]= in[i] * factor1;
      public static void main(String[] arg){
         int[] in2 = {1,2,3,4,5};
         int[] out2= {0,0,0,0,0};
         getFib2(in2,out2,2);
         for ( int j = 0 ; j <= out2.length-1;j++) {
                    System.out.println(out2[j]);
    {code}
    {code}
    CREATE or replace PROCEDURE getfib5 (x IN OUT numlist, y IN OUT numlist, k in number)
    AS LANGUAGE JAVA
    NAME 'tst.plsql3.getFib2(int[], int[],int)';
    set serveroutput on format wraped;
    declare
      in2 numlist := numlist(1,2,3,4,5,6);
      out2 numlist := numlist(0,0,0,0,0,0);
    begin
    --in2(0) := 1;
    --in2(1) := 2;
    --in2(2) := 3 ;
    for i in 1..in2.count
      loop
        dbms_output.put_line(in2(i));
      end loop;
       for i in 1..in2.count
      loop
        dbms_output.put_line(out2(i));
      end loop;
      getFib5(in2,out2,2);
      for i in 1..in2.count
      loop
        dbms_output.put_line(in2(i));
      end loop;
       for i in 1..in2.count
      loop
        dbms_output.put_line(out2(i));
      end loop;
    --dbms_output.put_line(in2.count);
    end;
    {code}
    {code}
    javac -source 1.5 -target 1.5 tst/plsql3.java
    {code}
    Error report:
    ORA-00932: inconsistent datatypes: expected a value at argument position 1 that is convertible to a Java int got an Oracle named TYPE (ADT, REF etc)
    ORA-06512: at "TK1.GETFIB5", line 1
    ORA-06512: at line 18
    00932. 00000 -  "inconsistent datatypes: expected %s got %s"
    *Cause:   
    *Action:

    http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:3696816290928

  • Passing an array of objects to a method.

    Hi I'm building a program to act as a CD Collection Database. An array of objects represents the entries: Artist, Album and NUmber of Tracks. What I want to do is in the Menu, user to choose wether he or she wants to Add new CD to collection, print or quit, if he/she does then I call a method addNewEntry, to which i pass the array of objects called array, and I want the user to enter the entries each in turn, after that i want the program to return to the method Menu and ask if he or she wants to quit, print or add new cd. The idea is that the details entered already would be contained in the array of objects [0], so the next set of details go to [1] and then to [2] and so on. I have build up the code at this stage but i get an error while copmiling and im totally stuck. Im a beginner in Java.
    Here is the code:
    //by Andrei Souchinski
    //Mini Project: CD Collection Database
    //Designed for a grade F
    //Defining new class of objects to represent CD database entries.
    //A database entry consists of the artist name, the album name and number of tracks.
    //A single entry can be entered by the user typing the details in and the entry can be printed out.
    import javax.swing.*;
    import java.util.*;
    public class MiniProject
         public static void main (String[] args)     
              System.out.println("\tCD Collection Database\n");
              System.out.println("1. Add new Compact Disk to the Database");
              System.out.println("2. Print out current database entries");
              System.out.println("3. Quit\n");          
              theMenu();
         public static void theMenu()
              CompactDisk [] array = new CompactDisk[20];
              String menu;
              menu = JOptionPane.showInputDialog("What would you like to do?");
              if (menu.equals ("3"))
                   JOptionPane.showMessageDialog(null, "Thank You For Using our Service! \nGoodbye!");
                   System.exit(0);     
              if (menu.equals ("2"))
              if (menu.equals ("1"))
              addNewEntry(array);
              else
                   JOptionPane.showMessageDialog(null, "Please select your choice form the menu");
                   theMenu();
         public int addNewEntry(int newcd[])
                   int i;          
                   newcd[i] = (JOptionPane.showInputDialog("Please enter the name of the Artist"));
                   newcd[i] = (JOptionPane.showInputDialog("Please enter the name of the Album"));
                   newcd[i] = (Integer.parseInt (JOptionPane.showInputDialog("Please enter the number of tracks on this album")));
    //A Compact Disk entry consists of three attributes: artist name, album and number of tracks
    class CompactDisk
         public String artistname; //Instance variables for artistname, albumname and numberoftracks.
         public String albumname;
         public int numberoftracks;
         public CompactDisk(String n, String a, int t)
         artistname = n; //Stores the 1st argument passed after "new Dates" into day
         albumname = a; //Stores the 2nd argument passed after "new Dates" into month
         numberoftracks = t; //Stores the 3rd argument passed after "new Dates" into year
         //When called from the main method, prints the contents of
         //artistname, albumname and numberoftracks on to the screen.
         public void printCompactDisk ()
                   String output = "\n " + artistname + "\n " + albumname + "\n " + numberoftracks;
                   System.out.println(output);
    }

    //by Andrei Souchinski
    //Mini Project: CD Collection Database
    //Designed for a grade F
    //Defining new class of objects to represent CD database entries.
    //A database entry consists of the artist name, the album name and number of tracks.
    //A single entry can be entered by the user typing the details in and the entry can be printed out.
    import javax.swing.*;
    import java.util.*;
    public class MiniProject
         public static void main (String[] args)     
              System.out.println("\tCD Collection Database\n");
              System.out.println("1. Add new Compact Disk to the Database");
              System.out.println("2. Print out current database entries");
              System.out.println("3. Quit\n");          
                theMenu();
         public static void theMenu()
              String menu;
              menu = JOptionPane.showInputDialog("What would you like to do?");
              if (menu.equals ("3"))
                   JOptionPane.showMessageDialog(null, "Thank You For Using our Service! \nGoodbye!");
                   System.exit(0);     
              if (menu.equals ("2"))
              if (menu.equals ("1"))
              addNewEntry();
              else
                   JOptionPane.showMessageDialog(null, "Please select your choice form the menu");
                   theMenu();
         public static void addNewEntry()
                   CompactDisk [] array = new CompactDisk[20];
                   int i = 0;
                   array.artistname = (JOptionPane.showInputDialog("Please enter the name of the Artist"));
                   array[i].albumname = (JOptionPane.showInputDialog("Please enter the name of the Album"));
                   array[i].numberoftracks = (Integer.parseInt (JOptionPane.showInputDialog("Please enter the number of tracks on this album")));
    //A Compact Disk entry consists of three attributes: artist name, album and number of tracks
    class CompactDisk
         public String artistname; //Instance variables for artistname, albumname and numberoftracks.
         public String albumname;
         public int numberoftracks;
         public CompactDisk(String n, String a, int t)
         artistname = n; //Stores the 1st argument passed after "new Dates" into day
         albumname = a; //Stores the 2nd argument passed after "new Dates" into month
         numberoftracks = t; //Stores the 3rd argument passed after "new Dates" into year
         //When called from the main method, prints the contents of
         //artistname, albumname and numberoftracks on to the screen.
         public void printCompactDisk ()
                   String output = "\n " + artistname + "\n " + albumname + "\n " + numberoftracks;
                   System.out.println(output);
    I've edited the code, itcompiles, but gives an error when i ran it..:(

  • Passing split array to function

    Anyone know how to pass an array to a function as seperate
    parameters i.e
    _array = [param1,param2,param3]
    functionToCall(param1,param2,param3)
    instead of: functionToCall(_array[0],_array[1],_array[2]);
    of having to go
    var1 = _array[0];
    var2 = _array[1];
    var3= _array[2];
    functionToCall(var1,var2,var3)
    Cheers, burnside

    DCIBurnside,
    > Marco Mind wrote:
    > Can't you just pass the array and indexs as a second
    array?
    That would only work if the desired function is written to
    accept two
    parameters formatted as arrays. DCIBurnside could certainly
    write an
    intermediary function, I suppose; but for that effort, it
    would be just as
    easy to pass in the parameters as already shown:
    functionToCall(_array[0],_array[1],_array[2]);
    Check out the methods of the Fuction class -- in particular
    Function.apply() -- which might be exactly what DCIBurnside
    is looking for.
    David Stiller
    Co-author, ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/dpsAS3QuickReferenceGuide
    "Luck is the residue of good design."

  • Pass an array of images???

    I am very new to java and my instructor gave us an assignment of doing a matching game using JButtons and an applet. I have 2 separate .java files (MemoryApplet.java and MemoryGame.java). MemoryApplet intializes the applet and passes an array of images to a method using the following code...
    icon = new MemoryGame();
    for(int i = 0;i<6;i++)
    imgArr[i] = getImage(getCodeBase(),"img" i".jpg");
    icon.setTheIcons(imgArr);
    In the MemoryGame file my setTheIcons method looks like this...
    public void setTheIcons(Image icon1[])
    The problem I am having is that I cannot convert the Image to an ImageIcon to put the image on the JButton. When I passed each image by itself not using an array, it worked fine, but I want to randomize the image locations so I thought passing the array would be the way to go. Any help would be greatly appreciated.
    Thanks, Chad

    If you want to use those images in JButton, so use the ImageIcon arrays like this:
    MemoryApplet
    // declare ImageIcon array
    ImageIcon[] imgArr = new ImageIcon[6];
    for(int i = 0;i<6;i++)
      // create new ImageIcon
      // path: path of images
      imgArr[i] = new ImageIcon(path + "img" + i + ".jpg");
    // initialize MemoryGame instance and call method
    icon = new MemoryGame();
    icon.setTheIcons(imgArr);Hope this help
    Liwh

  • Passing an array of integers to a method...

    here's the case, i have 2 array of integers parent and child. how can i pass the arrays in a method so i can evaluate the contents of both arrays?
    here's the block of the code that contains what i'm talking about.
    for(int i=0; i<tree.length; i++) {//separate child from parent      
         int[] parent = new int[(tree.length()/2)];
         int[] child = new int[(tree[i].length()/2)];
         for(int j=0, ctr=0; j<tree[i].length(); j++, ctr++) {               
              parent[ctr] = Integer.parseInt(Character.toString(tree[i].charAt(j))); //get the parents
              j++;
              child[ctr] = Integer.parseInt(Character.toString(tree[i].charAt(j))); //get the children
         if(isTree(parent, child)) //evaluate if case is a tree
         System.out.println("Is a tree");
         else
         System.out.println("Is not a tree");
    }//separate child fronm parent     

    geez, thanks... adding "static" did work.. >_< my bad, i'm new in java... and i'm sorry for calling you
    "sir", thanks a lot monica... ^^ by the way, it's 1:00 pm here asia.I'm glad it worked--do you understand what "static" means here?
    No problem about the "sir". I usually use "he" myself, if I don't know whether it should be he/she. And, around here on the forum (and software engineers at most companies), there are certainly more men than women. People tend to look at MLRon and assume my name is "Ron", but that's my last name. :)
    You don't need to call people "sir" or "ma'am" here. Just names or screen names (like MLRon) will do. :)
    Have a nice afternoon, then!

  • Passing an array as IN parameter to call a function

    I have a function the definition is
    TYPE VAR_VALUE_RECORD IS RECORD(VAR VARCHAR2(100),
                   VALUE VARCHAR2(100));
    TYPE VAR_VALUE_TAB IS TABLE OF VAR_VALUE_RECORD;
    FUNCTION GENERIC_WF(P_MSG_TYPE IN VARCHAR2,P_CDCS_NBR IN VARCHAR2, P_CDCS_SEQ IN VARCHAR2, P_DEBTORID IN NUMBER,
    P_EXTRAS IN VAR_VALUE_TAB) RETURN VARCHAR2;
    I am trying to call this function
    select WF_NOTIFICATIONS_PKG.GENERIC_WF('Manual Debt Establish Notification','2009A13636','001',105195359,'this is a test') from dual
    ERROR at line 1:
    ORA-06553: PLS-306: wrong number or types of arguments in call to 'GENERIC_WF'
    I am getting the above error, how do I pass the array as parameter.
    I will appreciate your help.
    Thnaks

    Hi,
    try this,
    Create OR Replace Package WF_NOTIFICATIONS_PKG Is
       Type VAR_VALUE_RECORD Is Record( VAR   Varchar2(100)
                                      , Value Varchar2(100));
       Type VAR_VALUE_TAB Is Table Of VAR_VALUE_RECORD Index BY Pls_Integer;
       Function GENERIC_WF( P_MSG_TYPE IN Varchar2
                          , P_CDCS_NBR IN Varchar2
                          , P_CDCS_SEQ IN Varchar2
                          , P_DEBTORID IN Number
                          , P_EXTRAS   IN VAR_VALUE_TAB ) Return Varchar2;
    End WF_NOTIFICATIONS_PKG;
    Create OR Replace Package Body WF_NOTIFICATIONS_PKG Is
       Function GENERIC_WF( P_MSG_TYPE IN Varchar2
                          , P_CDCS_NBR IN Varchar2
                          , P_CDCS_SEQ IN Varchar2
                          , P_DEBTORID IN Number
                          , P_EXTRAS   IN VAR_VALUE_TAB ) Return Varchar2 Is
       Begin
          Return ( P_EXTRAS(P_EXTRAS.First).var || ' - ' || P_EXTRAS(P_EXTRAS.First).Value );
       End GENERIC_WF;
    End WF_NOTIFICATIONS_PKG;
    SQL> Declare
      2     v_value_Tab WF_NOTIFICATIONS_PKG.VAR_VALUE_TAB;
      3     v_return    Varchar2(100);
      4  Begin
      5     v_value_Tab(1).var   := 'this is a test 1';
      6     v_value_Tab(1).value := 'this is a test 2';
      7 
      8     v_return := WF_NOTIFICATIONS_PKG.GENERIC_WF( 'Manual Debt Establish Notification'
      9                                                , '2009A13636'
    10                                                , '001'
    11                                                , 105195359
    12                                                , v_value_Tab );
    13 
    14     Dbms_Output.put_line(v_return);
    15  End;
    16  /
    this is a test 1 - this is a test 2
    PL/SQL procedure successfully completedRegards,
    Christian Balz

  • How to pass vector array to JasperReport

    I have a query looks like this... in my JasperReport. (select * from employee where employee_id = $P{Emp_ID} order by employee_id)
    I already created a vector array contains a list of employee IDs from database. Now, I want to pass the array into the query to get a specific list of employees.
    Similar to SQL prompt below.
    SQL> select * from employee where employee_id in (1,3,4,5,22,23,45) order by employee_id.

    jasontey,
    I'm doing the samething here but with arrays and I'm getting ClassCastException.
    Servlet1:Vector PatientInfoVector = new MdlPatient().getPatientInfo(userId,patientNumber);
    int patientLength = PatientInfoVector.size();
    MdlPatient[] PatientInfoArray = new MdlPatient[patientLength];
    for (int i=0; i<patientLength; i++)
    PatientInfoArray[i] = (MdlPatient)PatientInfoVector.elementAt(i);
    session.setAttribute("patientSession",PatientInfoArray);
    response.sendRedirect(response.encodeRedirectURL("/FsuSecurity/SrvSecurity"));
    SrvSecurity:
    MdlPatient PatientInfo = (MdlPatient)session.getAttribute("patientSession"); This is where I'm getting the ClassCastException.
    int patientNumber = PatientInfo.getPatientNumber();
    Thanks if you can help,
    Doug

  • Passing an array over http?

    Hi,
    I want to pass two arrays over a http connection based on a users action i.e. clicking a button. I have ASP on my server (server side javascript). Can anyone give any help? Would I go about putting the array into a byte array as with other standard string and int variables?
    byte[] data = (("array1_="+(sRRowArray)+"&"+"array2_="+(sRSeatArray)).getBytes());I have tried this to no avail.
    Is there anything other than request.form that I have to use on the server side to get the arrays?
    Thanks in advance,
    Harry

    Any help would be much appreciated!! Would I have to pass the array in a similar way in which images are sent over http? If so, does anyone have any examples of doing this. I need help on this problem urgently.
    Thanks in advance,
    Harry.

  • Problem passing multiple array lists to a single method

    Hi, all:
    I have written a generic averaging method that takes an array list full of doubles, adds them all up, divides by the size of the array list, and spits out a double variable. I want to pass it several array lists from another method, and I can't quite figure out how to do it. Here's the averager method:
         public double averagerMethod (ArrayList <Double> arrayList) {
              ArrayList <Double> x = new ArrayList <Double> (arrayList); //the array list of integers being fed into this method.
              double total = 0;//the total of the integers in that array list.
              for (int i = 0; i < x.size(); i++) {//for every element in the array list,
                   double addition = x.get(i);//get each element,
                   total = total + addition; //add it to the total,
              double arrayListSize = x.size();//get the total number of elements in that array list,
              double average = total/arrayListSize;//divide the sum of the elements by the number of elements,
              return average;//return the average.
         }And here's the method that sends several array lists to that method:
         public boolean sameParameterSweep (ArrayList <Double> arrayList) {
              sameParameterSweep = false;//automatically sets the boolean to false.
              arrayList = new ArrayList <Double> (checker);//instantiate an array list that's the same as checker.
              double same = arrayList.get(2); //gets the third value from the array list and casts it to double.
              if (same == before) {//if the third value is the same as the previous row's third value,
                   processARowIntoArrayLists(checker);//send this row to the parseAParameterSweep method.
                   sameParameterSweep = true;//set the parameter sweep to true.
              if (same != before) {//if the third value is NOT the same,
                   averagerMethod(totalTicks);//go average the values in the array lists that have been stored.
                   averagerMethod(totalNumGreens);
                   averagerMethod(totalNumMagentas);
                   sameParameterSweep = false;
              before = same; //problematic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         return sameParameterSweep;
         }Obviously, the problem is that I'm not passing the array lists from this method to the averager method the right way. What am I doing wrong?

    Encephalopathic wrote:
    There are several issues that I see, but the main one is that you are calculating average results but then just discarding them. You never assign the result to a variable.
    In other words you're doing this:
    averagerMethod(myArrayList);  // this discards the resultinstead of this:
    someDoubleVariable = averagerMethod(myArrayList); // this stores the resultAlso, do you wish to check for zero-sized array lists before calculating? And what would you return if the array list size were zero?So in solving that problem, I've come up with another one that I can't figure out, and I can't fix this problem until I fix that.
    I have several thousand lines of data. They consist of parameter sweeps of given variables. What I'm trying to do is to store pieces of
    data in array lists until the next parameter adjustment happens. When that parameter adjustment happens, I want to take the arraylists
    I've been storing data in, do my averaging thing, and clear the arraylists for the next set of runs under a given parameter set.
    Here's the issue: I'm having the devil of a time telling my application that a given parameter run is over. Imagine me doing stuff to several variables (number of solders, number of greens, number of magentas) and getting columns of output. My data will hold constant the number of soldiers, and for, say, ten runs at 100 soldiers, I'll get varying numbers of greens and magentas at the end of each of those ten runs. When I switch to 150 soldiers to generate data for ten more runs, and so forth, I need to average the number of greens and magentas at the end of the previous set of ten runs. My problem is that I can't figure out how to tell my app that a given parameter run is over.
    I have it set up so that I take my data file of, say, ten thousand lines, and read each line into a scanner to do stuff with. I need to check a given line's third value, and compare it to the previous line's third value (that's the number of soldiers). If this line has a third value that is the same as the previous line's third value, send this line to the other methods that break it up and store it. If this line has a third value that is NOT the same as the previous line's third value, go calculate the averages, clear those array lists, and begin a new chunk of data by sending this line to the other methods that break it up and store it.
    This is not as trivial a problem as it would seem at first: I can't figure out how to check the previous line's third value. I've written a lot of torturous code, but I just deleted it because I kept getting myself in deeper and deeper with added methods. How can I check the previous value of an array list that's NOT the one I'm fiddling with right now? Here's the method I use to create the array lists of lines of doubles:
         public void parseMyFileLineByLine() {
              totalNumGreens = new ArrayList <Double>();//the total number of greens for a given parameter sweep
              totalNumMagentas = new ArrayList <Double>();//the total number of magentas for a given parameter sweep.
              totalTicks = new ArrayList <Double>();//the total number of ticks it took to settle for a given parameter sweep.
              for (int i = 8; i < rowStorer.size() - 2; i++) {//for each line,
                   checker = new ArrayList <Double>();//instantiates an array list to store each piece in that row.
                   String nextLine = rowStorer.get(i); //instantiate a string that contains all the information in that line.
                   try {
                        Scanner rowScanner = new Scanner (nextLine); //instantiates a scanner for the row under analysis.
                        rowScanner.useDelimiter(",\\s*");//that scanner can use whitespace or commas as the delimiter between information.
                        while (rowScanner.hasNext()) {//while there's still information in that scanner,
                             String piece = rowScanner.next(); //gets each piece of information from the row scanner.
                             double x = Double.valueOf(piece);//casts that stringed piece to a double.
                             checker.add(x);//adds those doubles to the array list checker.
                   catch (NoSuchElementException nsee) {
                        nsee.printStackTrace();
                   //System.out.println("checker contains: " + checker);
                   processARowIntoArrayLists(checker);//sends checker to the method that splits it up into its columns.
         }

  • Pass javascript array to java

    hii
    I have to pass a javascript array to my java MyAction.do . So how can i do it???
    Thnking You

    Being a Java newbie, I can't give you a definitive on how to pass the array to a client-side applet, although it should be possible.
    As for passing it to something server-side there are only a couple ways: in a GET request on the query string or in a POST. No matter what, you will have to flatten the array with some method or other, to convert it into a text string that can be parsed on the other end.
    I personally favor using hidden form elements and posting the data, because otherwise you have to worry about urlencoding your query string. You could just use javascript itself to write a series of hidden text inputs and then submit the form, so all your form handler has to do is pick up the variables.
    Let's say the array is named "myarray":
    Code:
    +<script language="Javascript">+
    document.writeln("<form name=\"myform\" method=\"POST\" action=\"myserver/myhandler.jsp\">")
    for(i = 0; i < myarray.length; i+){+
    document.writeln("<input type=\"hidden\" name=\"myarray[" i + "]\" value=\"" + myarray[i] + "\">")+
    +}+
    +document.writeln("</form>")+
    +document.myform.submit()+
    +</script>+
    I know this is clunky and "low-tech" but it will work, and has the benefit of working for any server-side platform that can handle forms

  • I have some problems while passing control array as refernce to the sub vi and sub VI crashes not deterministically after few minutes

    Hallo every body,
    i have some questions when i am passing the refernces to the sub_VI
    1)when i run the application, the blink indicator(in main VI) starts blinking. even in sub_vi for true case i set it true and for false case i set it false. why from begining of the execution it starts blinking?
    2)the stop button i am using in main VI is too slow. when i press the stop button it takes too much time to stop the application. why?
    3)the array control (amplitude, freq,total time taken )
    i am creating references of array. then these references i am sending to for loop. where it will convert as scalr values and then these scalar values to the sub_vi. opposite to it i am getting the reference of scalar cycles value and i am buliding an array of these scalar cycles to show it in indicator. it seems not to be working properly. why?
    for this exexution some times i get error 91.
    4) sometimes in the begining i get error 1055. why?
    5) my sub vi crashes not deterministically.some time times after 2 minutes. some times after 5 minutes. by crash i mean i dont get an error but on the oscilloscope i see not smooth sine signal, but some strange broken, unbroken, delayed(all together mixed signals). why?
    thanks for the important suggestions.
    Regards
    Attachments:
    Check0.llb ‏204 KB

    1) At some point the Blinking property gets set. Then the errors result in the program terminating. The property never gets reset. Setting a Property node in the main VI with Blinking = False prevents this.
    2) You have 1 second Wait until next multiple delays in both the main and subVI loops. Depending upon which delays have executed when you push the Stop button it can take two seconds or more before all the loops execute again and note the Stop button.
    3) The references are to arrays. (Time Taken, Amplitude, Cycles and Frequency) but you are connecting scalar values to the Values properties. Variant does not mean you can connect anything and it will convert to what you want. Once the Type has been set (when the control was created), the property node input matches that type.
    4) 5) I never got this far so I cannot explain these errors. However, I suspect that once you fix the others, these will either be fixed also or the cause will become more apparent.
    Lynn

  • How do I pass an array of structs to a C function using the dll flexible prototype adapter?

    What I want to do is pass into a C dll function a variably sized Array of structs of type TPS_Data. My Code compiles but when I run it in TestStand, I get an error -17001; Program Error. "Cannot allocate 0 size buffer Error in parameter 2, 'OpenFrdData'."
    I've allocated the Array of structs, and all of the information is there before I call my function, so is it my prototype? Or am I asking too much of the DLL Flexible Prototype Adapter to pass an Array of Structs?
    I can pass in a single struct of type TPS_Data and that works, but not an array.
    Here's the relevent code:
    typedef struct TPS_DATA
    char Report_Number[256];
    char System_Name[256];
    char Open_Date[256];
    char UUT_Part_Number[256];
    char UUT_Serial_Number[256];
    char UUT_Name[256];
    char Open_Employee_Name[256];
    char Open_Employee_Number[256];
    char Close_Employee_Name[256];
    char Close_Employee_Number[256];
    char Close_Date[256];
    } TPS_Data;
    typedef struct TPS_DATA_ARRAY
    TPS_Data DataRecord;
    } TPS_DataArray;
    long __declspec(dllexport) __stdcall OpenDialog (CAObjHandle Context, TPS_DataArray *TpsData[], const char *psFaultStr, char *sComments, const int nCount);

    OK,
    I can pass the data to the DLL function, using the following types:
    typedef struct StringArrayType
    char string[10][256];
    } StringArray;
    typedef struct MultiStringArrayType
    StringArray Record[10];
    } MultiStringArray;
    void __declspec(dllexport) __stdcall ATP_TestStructPassing(StringArray Strings)
    return;
    void __declspec(dllexport) __stdcall ATP_TestMultiStructPassing(MultiStringArray *Strings)
    return;
    But when the MultiStruct function Exits, TestStand reports an Error:
    -17501 "Unexpected Operating System Error" Source: 'TSAPI'
    There doesn't seem to be a way around this, and once the error occurs, I have to force quit TestStand. I've included the sequence file, and the dll code can be compiled from the fun
    ctions shown above.
    Any thoughts on how to get around this error would be greatly appreciated.
    Attachments:
    StructArrayPassing.seq ‏16 KB

Maybe you are looking for