Setting array index types

I doubt this is possible, but I'm trying to clean up my variables I have and group stuff, such as user information into an array. Current I have:
String name = null;
String email = null;
int work = 0;
int sort1 = 0;
int sort2 = 0;
int pos1 = 0;
int pos2 = 0;I'd like to make an array to store everything in, but is it possible to make the first 2 indexs Strings and the other 5 ints?

No, but you probably don't need five work integer
variables anyway, and if you do you probably don't
need them all declared in the same place, and if you
do you probably have better names for them than
'work', 'sort1', ...Well, 'work' identifies if the manager is full or part time, 'sort1' and 'sort2' identify which sorts the manager works on, and 'pos1' and 'pos2' identify the positions of both sorts.
>
Try declaring each of them in the smallest possible
enclosing scope.Well, they are shared throughout a few classes so that won't work.

Similar Messages

  • How do I set cursor.index to anywhere in the graph array?

    I am using LV 8.5.1 and feeding an XY graph with an X-Y array of data. Only a section of the array is displayed on the graph. I have a cursor (single-plot).
    I would like to set Cursor.Index property node of the cursor associated with the plot to the maximum index value of the graphed array regardless of the XScale range. I don't seem to be able to do it. I cannot set it beyond a certain number. When I rescale the graph I have a new maximum number. Is this what should happen?
    To get around this, I am momentarily setting the XScale.ScaleFit property to 1, which then allows me to set Cursor.Index to maximum (I then immediately reduce my scale range appropriately). I am having to do this before every occurrence of setting the Cursor.Index in case the new setting exceeds the currently allowed maximum value. Just seems a bit clunky.
    Thanks for any help.

    This is no longer a problem. My data is too big to feasibly be fed into a graph so am having to chop it up and use my own index pointer.

  • Help with array / indexed property

    Hi,
    I am trying to save the value of multiple dropdowns in the Session Bean. Therefore, I created an index property "rule" in the Bean.
    Each time the page is loadad, a different dropdown appears depending on the previous choices. If the ok button is clicked, the action is performed to save the current dropdown value in the index property:
    public String button1_action() {
    int cnt = 1;
    // if page was loaded before, replace count
    if (getAdminBean().getCount() > 0) {
    cnt = getAdminBean().getCount() +1;
    } else {
    // save current count in Session
    getAdminBean().setCount(cnt);
    setValue("#{AdminBean.rule[cnt-1]}", selectme.getValue());
    This is the error message:
    Exception Details: javax.faces.el.PropertyNotFoundException
    Error setting property '-1' in bean of type null
    Possible Source of Error:
    Class Name: com.sun.faces.el.PropertyResolverImpl
    File Name: PropertyResolverImpl.java
    Method Name: setValue
    Line Number: 153
    I have played around and even the following code would not work to save a value at the first position of the index property:
    setValue("#{AdminBean.rule[0]}", selectme.getValue());
    Can anyone help?
    Thanks,
    Nils

    You can not set the index as you use here i.e
    #{AdminBean.rule[cnt-1]}
    is not correct. Because in JSF the "[" is used for some other purpose.
    I would suggest you to use another property called "index"
    setValue("#{AdminBean.index", cnt-1);
    setValue("#{AdminBean.rule", selectme.getValue());
    Inside the session bean, in the method setRule get the index (already set) and place your value in the correct indexed array.
    Same logic you can use to get the value too
    setValue("#{AdminBean.index", cnt-1);
    getValue("#{AdminBean.rule");
    the method getRule() should get the value for the index and return it.
    - WInston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • StringIndexOutOfBoundsException using ARRAY data type

    Hi all.
    JDK 1.5.0_03, Oracle 9.2.0.4, 9i thin drivers.
    I'm trying to use the ARRAY data type to submit a large amount of data to a stored procedure. Unfortunatley I'm getting an error when using the oracleCAllableStatement.setArray method. I've successfully set up my types in the database, and I can create my StructDescriptor and ArrayDescriptor objects but that's as far as I get.
    Here's my code:
    connection = ConnectionManager.getRawConnection(DatabaseProperties.CSA_DB);
    connection.setAutoCommit(false);
    ARRAY array = getDatabaseArray(timeSeriesList, date, connection);
    String result = new String();
    statement = (OracleCallableStatement)connection.prepareCall("{call DATA_LOAD.ARCHIVE_TIMESERIES(?, ?)");
    statement.setARRAY(1, array);
    statement.registerOutParameter(2, OracleTypes.VARCHAR, result);
    statement.execute();
    LOG.info(result);
    connection.commit();
    The line highlighted is where it fails. The exception is below. Unfortunatley its a Java exception rather than a Oracle one so not much help there.
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 40
         at java.lang.String.charAt(Unknown Source)
         at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:123)
         at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:69)
         at oracle.jdbc.driver.OracleConnection.nativeSQL(OracleConnection.java:1181)
         at oracle.jdbc.driver.OracleStatement.expandSqlEscapes(OracleStatement.java:6412)
         at oracle.jdbc.driver.OracleStatement.parseSqlKind(OracleStatement.java:6401)
         at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:152)
         at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:77)
         at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:48)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1134)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:988)
         at com.db.csa.systems.csa.timeseries.DataArchivedTimeSeriesProvider.archiveTimeseriesForDate(DataArchivedTimeSeriesProvider.java:46)
         at com.db.csa.experiments.TimeseriesArchiver.main(TimeseriesArchiver.java:26)
    I'm now completely stuck as short of decompiling the class that's throwing the exception I have no idea what's going on.
    Anyone got any ideas?
    Thanks, Rob
    Message was edited by:
    user470390

    Hi,
    Shouldn't:
    statement = (OracleCallableStatement)connection.prepareCall("{call DATA_LOAD.ARCHIVE_TIMESERIES(?, ?)");be this:
    statement = (OracleCallableStatement)connection.prepareCall("{call DATA_LOAD.ARCHIVE_TIMESERIES(?, ?)}");i.e. have a closing brace?
    - Mark

  • WHat is the best index type for non uniqueness / Varchar columns in SQL 2008 R2

    Hello All Greetings,
    Please help me here with my doubt,
    in my table i have two columns about a million rows, it has about 20 columns in it, three columns with name as Period, Gender so most of the time these two columns use in where clause,
    Gender  will contain Either M or F , Period contains YYYY-Month (2013-December, 2013-August) etc so i would like to add a Index to these two columns so that in will increase the performance, so please let me know what type of indexes i need to add to
    these columns in the table,
    please note that only one time we will add data to the table which will take only 2 minutes but we query the table every day
    so my question what is the best index type that i need to create on columns with non uniqueness values in the column.,
    Thank you In Advance,
    Milan

    There is nothing whatever wrong with creating an index on a VARCHAR column, or set of columns.
    Regarding the performance of VARCHAR/INT, as with everything in a RDBMS, it depends on what you are doing. What you may be thinking of is the fact that clustering a table on a VARCHAR key is (in SQL Server) marginally less efficient than clustering on a monotonically
    increasing numerical key, and can introduce fragmentation.
    Or you may be thinking of what you have heard about writing JOINs on VARCHAR columns - it is true, it is a little less efficient than a JOIN on numeric type, but it is only a little less efficient, nothing that would lead you to never join on varchar cols.
    None of this does not mean that you should not create indexes on VARCHAR columns. A needed index on a VARCHAR column will boost query performance, often by orders of magnitude. If you need an index on a VARCHAR, create it. It makes no sense to try to find an
    integer column to create the index on - the engine will never use it.
    Check this reference: http://stackoverflow.com/questions/14041481/is-it-good-to-create-a-nonclustered-index-on-a-column-of-type-varchar
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • Web Analysis report error : Array Index out of range :1

    while running from workspace , below error is being thrown after making few changes to the layout (e.g. moving Measures from Page to Row ) though Design for HTML setting applied.
    Array Index out of range :1
    These reports are running well in WA studio.
    Can any one advise on this please.

    Array index out of range: 1The only time you will get that error is when you are accessing an elements index that is not present in the actual indexes in that array

  • Error opening web analysis report in workspace: Array index out of range:2

    I am able to view this report in web analysis studio with no errors..Its only when I go to workspace and open report do I get following error: Array index out of range:2.
    Any suggestions?

    Have you tried checking the "Design for HTML" from the Edit toolbar to see if you get any error when saving?
    Do you have any advanced items on the report, as there are 4 types of differences between Studio and HTML:
    - font differences, Workspace (DHTML) uses the WA Server fonts whereas WA Studio client machine fonts.
    - Service Buttons are very restricted using Workspace
    - Display: Tab selection, Splitter panels, Slider selection do not render in Workspace
    - Cannot restrict WA Tools menu in Workspace at all, where you can in the Studio.
    For exact details check out the Hyperion Web Analysis Studio User’s Guide from the Doc Library:
    http://download.oracle.com/docs/cd/E10530_01/doc/nav/portal_4.htm

  • What is the maximum rows allowed in PLSQL array table type?

    Hi,
    I have a procedure and it contains the cursor which will fetch more than 500 records. And i have 5 output parameters to store the values coming from the cursor. I don't want to store that into custom table. I want to save it one table type array or something like that. Now i want to know what is the maximum storage of array table type? If i store more than 500 data, how will be the performance? Then is there any other way to achieve this? And that should not decrease the preformace.Let me know your thoughts.
    Thanks

    It really depends on what you are planning to do with the records once you return them from your stored procedure, and what client is on the receiving end of the results.
    One option would be to just return a ref cursor and let the client deal with retreiving the rows themselves, whether one by on or by a bulk collect. Another option would be to declare a table of records matching the result set and do a bulk collect into that table type in your procedure and return the table type to the caller. You could also declare a table type for each field in the resultset, bulk collect the records into thos types and return one for each field.
    Personally, I would likely go with returning a ref cursor. Both of the collect the resultset in your procedure and then return collections to the caller methods require memory on the database server to hold the entire resultset and memeory on the client to hold the entire resultset. While 500 records is probably not going to be too bad on memory, if the result set grows, you will run into memory issues at some point.
    John

  • Can't store new target Array index out of range: 1 - SLD Configuration

    Hello ,
    Issue is regarding SLD configuration , We have ABAP + Java Addin on Suse Linux x86 ( 64 bit ) with Oracle 9.x .
    Java instalaltion competed succesfully , J2EE is up and runnung while configuring SLD , Data Supplier Bridge - Configure the data supplier bridge - Update SLDs
    As I set Update local SLD (sld/active) to true it gives error : Can't store new target Array index out of range: 1
    ( Error recorded in default.trace ,
    #1.5#001635052D79005D000000010000393A00041904004A592B#1153404882278#com.sap.engine.library.monitor.mapping.ccms.Trace##com.sap.engine.library.monitor.mapping.ccms.Trace######87587b2017f911dbc661001635052d79#SAPEngine_System_Thread[impl:5]_82##0#0#Error##Plain###RegisterNode</Services/Web Services/Requests Number/sap.com/com.sap.engine.heartbeat/GRMGWSTest/CurrentClient>: com.sap.mona.api.JMonException: com.sap.mona.api.JMonAPIException: Internal error in tree structure#
    #1.5#001635052D790049000000060000393A000419040226E9F1#1153404913510#com.sap.lcr.sagent.BuilderDirector#sap.com/com.sap.lcr#com.sap.lcr.sagent.BuilderDirector#J2EE_ADMIN#317####29009b1017fa11db96bd001635052d79#SAPEngine_Application_Thread[impl:3]_14##0#0#Error#1#/Applications/SLD#Plain###Can't access http store#
    #1.5#001635052D790049000000070000393A000419040226EA90#1153404913511#com.sap.lcr.sagent.BuilderDirector#sap.com/com.sap.lcr#com.sap.lcr.sagent.BuilderDirector#J2EE_ADMIN#317####29009b1017fa11db96bd001635052d79#SAPEngine_Application_Thread[impl:3]_14##0#0#Error##Plain###Thrown:
    com.sap.lcr.api.cimclient.LcrException: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
    I have already through updated Component Repository – SAP Note : 669669 . 
    Regards ,
    Santosh

    Hi,
    I am having exactly the same issue. Would you please advise what the solution was?
    Thanks,
    Murad.

  • Array Index out of bound exception

    public Name[] getName() {
              Name[] retVal = new Name[0];
              retVal[0] = this.getNameInstance();
              return retVal;
         public void setName(Name[] theName) {
              theName[0]=this.getNameInstance();
         private Name myNameInstance = new Name();
         public void setNameInstance(Name theNameInstance) {
              if(isValidName(theNameInstance)){
              myNameInstance = theNameInstance;
         public Name getNameInstance() {
              return myNameInstance;
         }I am getting an array Index out of bound eception in the method setName, Can any one tell me where I am doing wrong?

    The array passed in must be empty. I suggest using the debugger for problems like these. If you don't know how to use the debugger, here's a start:
    (Assuming you have a debugger, any IDE you'd be using will)
    1. Set a breakpoint on or before your line of question. In this case, place it on the line of code in your setName() method. Set a breakpoint by either right clicking on that line and selecting "Add breakpoint," or simply click on the far left side of the editor window, right next to the line number. Either way, a little dot will appear to mark the breakpoint.
    2. Execute your code in Debug mode rather than release mode. This might mean clicking on the little bug-looking icon "Debug" rather than "Run."
    3. Your code will execute and you'll enter the debug perspective when that breakpoint is reached. There, in the variables window, you'll see your array and any information about it, particularly its size and contents.

  • Array data type in SQL server

    Hi there,
    I have stored procedure which does have array data type. recently we have migrated oracle to SQL server
    but this array datatype doesn't support in SQL server.
    How can we rewrite this stored procedure to make it work exactly same as Oracle SP.
    Can you please help on this.
    ALTER PROCEDURE [dbo].[New1]
    @i_ID dbo.t_IdArray READONLY ,
    @i_ArraySize INT ,
    @SWP_Ret_Value FLOAT = NULL OUTPUT
    AS
    Begin
    UPDATE fmm.SITES
    SET DISPLAY_ORDER = id.t_RowNum
    FROM @i_ID id
    JOIN dbo.SITE1 s
    on s.SITE_ID = id.t_ID
    end
    Thanks for your help.

    Hi Latheesh,
    I have tried your bit except configure the SQLCommand and TVP parameter I don't where I need to do this bit.
    Without that bit I have tried your code it was throwing an error like this
    Operand type clash: int is incompatible with t_IdArray
    Can you please have a look .
    Thanks,
    RK
    can you show the definition for  dbo.t_IdArray
    what does it contain?
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Setting Array of class field from C++

    Hi,
    Consider I have two class
    Class A{
    B[] bclasses;
    Class B{
    int first;
    int second;
    Now i have
    jclass ACls= env->FindClass("A");
    How to create array of B, get the fields of B, assign value of B and assign array of B from C++ to Java. Please explain with example

    For each B
    -Get the class (do it the first time.)
    -Create the instance
    -Call the construtor
    -Get each member variable.
    -Set the value of each member variable.
    To do A
    -Get the class (do it the first time.)
    -Create the instance
    -Call the construtor
    -Get each member variable.
    -Set the value of each member variable - as an array
    . - Get array class
    . - Create instance
    . - Initialize each array index using the B method above.

  • Reg: PLS-00418: array bind type must match PL/SQL table row type error

    I am trying to access a table of records through JDBC OracleCallableStatement. I am able to do it fine for all mappings except for the ones below
    TYPE CAT_CD_TYPE IS TABLE OF A.B %TYPE INDEX BY BINARY_INTEGER;
    TYPE ORG_CD_TYPE IS TABLE OF C.D %TYPE INDEX BY BINARY_INTEGER;
    Column B is CHAR(1) and Column D is CHAR(2). I am trying to register the out parameters of Oraclecallablestatement as
    cstmt.registerIndexTableOutParameter(2, 2000, OracleTypes.CHAR, 0);
    cstmt.registerIndexTableOutParameter(3, 2000, OracleTypes.CHAR, 0);
    All the other mappings work fine. These two fail with the error
    SQLException in invokeDBPackage() : ORA-06550: line 1, column 32:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 35:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I tried other OracleTypes mappings too but no luck so far.
    Any advice on this would be greatly appreciated.

    Hi,
    I'm not sure it's reasonable to expect someone to sift through that much stuff.
    Which parameter is it having a problem with?
    Can you modify the following to reproduce the behavior?
    Thanks
    Greg
    create package mypack5 as
    TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
    PROCEDURE test_it(thearray IN v2array, numrecs out number);
    END;
    CREATE or replace PACKAGE BODY MYPACK5 AS
    PROCEDURE test_it(thearray IN v2array, numrecs out number)
    IS
    begin
    numrecs := thearray.count;
    END;
    END;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class indexby
    public static void Main()
    OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
    con.Open();
    OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
    Param1.Direction = ParameterDirection.Input;
    Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    Param1.Size = 3;
    string[] vals = { "foo", "bar", "baz" };
    Param1.Value = vals;
    OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
    cmd.ExecuteNonQuery();
    Console.WriteLine("{0} records passed in", Param2.Value);
    con.Close();
    }

  • PLS-00418: array bind type must match PL/SQL table row type

    If a PL/SQL table is indexed by CHAR and is a parameter
    in a Stored Program, we are not able to call the stored
    program from the Java code.
    We get the following error code.
    java.sql.SQLException: ORA-06550: line 1, column 62:
    PLS-00418: array bind type must match PL/SQL table row type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    But if we change the CHAR into VARCHAR2 then it works.
    We are using Oracle9i Enterprise Edition Release 9.2.0.5.0 -64bit Production ,
    JServer Release 9.2.0.5.0 - Production
    and JDK1.4.
    Thanks
    Push..

    Hi,
    I'm not sure it's reasonable to expect someone to sift through that much stuff.
    Which parameter is it having a problem with?
    Can you modify the following to reproduce the behavior?
    Thanks
    Greg
    create package mypack5 as
    TYPE v2array is table of emp.ename%type index by BINARY_INTEGER;
    PROCEDURE test_it(thearray IN v2array, numrecs out number);
    END;
    CREATE or replace PACKAGE BODY MYPACK5 AS
    PROCEDURE test_it(thearray IN v2array, numrecs out number)
    IS
    begin
    numrecs := thearray.count;
    END;
    END;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class indexby
    public static void Main()
    OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger;");
    con.Open();
    OracleCommand cmd = new OracleCommand("mypack5.test_it", con);
    cmd.CommandType = CommandType.StoredProcedure;
    OracleParameter Param1 = cmd.Parameters.Add("param1", OracleDbType.Varchar2);
    Param1.Direction = ParameterDirection.Input;
    Param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    Param1.Size = 3;
    string[] vals = { "foo", "bar", "baz" };
    Param1.Value = vals;
    OracleParameter Param2 = cmd.Parameters.Add("param2", OracleDbType.Int32, DBNull.Value, ParameterDirection.Output);
    cmd.ExecuteNonQuery();
    Console.WriteLine("{0} records passed in", Param2.Value);
    con.Close();
    }

  • Seeting Array index

    Can anyone tell me if it is possible to create an array, and set the index to start at an element other than 0? I want to start my inedx at 2 with 11 elements rather than starting at 0 with elements 0 - 10. Please help! Thanks.

    I agree with the other posts, why would you want to do this?
    I would think either skipping the first few elements (as previously suggested) or using the number that you want to start with to subtract from the index (ie. if you want the index to start at 2, just reference the array through index-2) would approximate the functionality you are requesting. Although neither solution is particularly clear or elegant.

Maybe you are looking for