How to create a Double dimension array dynamically

Hello,
If I have the following code running...
String[][] str = new String[1][3];
str[0]0] = "AAA";
str[0][1] = "BBB";
str[0][2] = "CCC";
I want to do the same code using runtime object creation. i.e.
String class_name = "java.lang.String";
How will I write the above mentioned code without using the hard code String class, i.e. I have to use class_name instead of "String".
Please help me.
Thanks in advance,
Anmol

Thanks Drake,
I got the solution i.e.
String class_name = "java.lang.String";
String ele_type = "java.lang.String";
int ele_size = 3;
String s1 = new String("AAA");
String s2 = new String("BBB");
String s3 = new String("CCC");
ArrayList ar = new ArrayList();
ar.add(s1);
ar.add(s2);
ar.add(s3);
Object base_obj = java.lang.reflect.Array.newInstance(Class.forName(class_name), new int[]{1,ele_size});
Object child_obj = java.lang.reflect.Array.newInstance(Class.forName(ele_type), ele_size);
for(int i=0;i<ele_size;i++){
Array.set(child_obj, i, ar.get(i));     
Array.set(base_obj,0,child_obj);               
// base_obj object is same as str shown in the above code
Thanks,
Anmol

Similar Messages

  • Create a 2-dim array dynamically

    Hello!
    I have had this problem here before but try one moore time :-)
    This is the thing: We have a text-file from which we read. This textfile can be different from time to time. From this textfile we can catch numbers of columns and numbers of rows that a 2-dim array should have. The problem is how one can create this 2-dim array dynamically? We have a while-loop that the program runs inside already. Must one use the while-loop to solve this problem? Or can one solve this with only a for-loop? Hope you understand how I mean :-) Best regards

    OK, I thought you want to read an array of the same size as the actual data in the file. You cannot read a 4x10 array if the file only contains data for a 3x5 array .
    Is the array size determined by the data in the file or by some other calculation?
    I would still read the entire file, then you can cut out a 2D subset using "array subset". This should not be a problem unless you have millions of array elements.
    LabVIEW Champion . Do more with less code and in less time .

  • How to create and use mutable array of UInt8

    Hello!
    If I get it right, UInt8 *buffer, buffer - is a pointer to a start of array?
    Then how to create and use mutable array of UInt8 pointers?
    The main target is a creation of the module that will store some byte array requests and will send all of them at the propriate moment.

    I try
    - (void) scheduleRequest:(UInt8 *)request {
    if (!scheduledRequests) scheduledRequests = [[NSMutableArray array] retain];
    [scheduledRequests addObject:request];
    But get warning:"passing argument 1 of 'addObject:' from incompatible pointer type"

  • How to create a roadmap ui element dynamically in webdynpro abap?

    Dear  team
    iam new for webdynpro my question is how to create the road map programme dynamically using webdynpro
    could you tell me what are the steps i have to take, what are the elements i have to bind?
    and what code & where i have to write the code?
    regards
    sathya

    Hi Sathya,
                  Write the follwing code in WDDOMODIFYVIEW method to create a Dynamic ROADMAP and also create an attribute of
                   type string to control the selection of steps in road map.
    method WDDOMODIFYVIEW .
      data : lr_ele type ref to if_wd_view_element.
      data : lr_rm type ref to cl_wd_road_map.
      data : lr_step type ref to cl_wd_road_map_step.
      data: lr_container type ref to cl_wd_transparent_container.
      data : lr_flowdata type ref to cl_wd_flow_data.
      CALL METHOD view->get_root_element
        receiving
          root_view_element = lr_ele.
      lr_container ?= lr_ele.
    CALL METHOD cl_wd_road_map=>new_road_map
      EXPORTING
        id                       = 'ROADMAP'
      receiving
        control                  = lr_rm.
    CALL METHOD lr_rm->bind_selected_step
      EXPORTING
        path   = 'VALUE'.
    CALL METHOD cl_wd_flow_data=>new_flow_data
      EXPORTING
        element     = lr_rm
      receiving
        control     = lr_flowdata.
    CALL METHOD lr_container->add_child
      EXPORTING
        index     = 1
        the_child = lr_rm.
    CALL METHOD cl_wd_road_map_step=>new_road_map_step
      EXPORTING
        id                  = 'ONE'
        name                = '1'
      receiving
        control             = lr_step.
    CALL METHOD lr_rm->add_step
      EXPORTING
        index    = 1
        the_step = lr_step.
    CALL METHOD cl_wd_road_map_step=>new_road_map_step
      EXPORTING
        id                  = 'TWO'
        name                = '2'
      receiving
        control             = lr_step.
    CALL METHOD lr_rm->add_step
      EXPORTING
        index    = 2
        the_step = lr_step.
    CALL METHOD cl_wd_road_map_step=>new_road_map_step
      EXPORTING
        id                  = 'THREE'
        name                = '3'
      receiving
        control             = lr_step.
    CALL METHOD lr_rm->add_step
      EXPORTING
        index    = 3
        the_step = lr_step.
    endmethod.
    Then you can use the context attribute to navigate between the steps and do respective actions.

  • How to create an attribute dimension in Essbase Studio?

    I cannot figure out how to create an attribute dimension using Essbase Studio. The online help states that I need to "Find the Attribute settings grouping in the center" of the member properties dialog box. I suspect that I'm having a problem figuring this out because I don't have the attribute dimension properly defined in the relational data source or in the mini-schema. I've tried creating a table with no key relationship to the other tables and with no logical joins defined, but that doesn't seem to help. Any ideas?

    so in the 11.1.1 version you would click on the member name in the hierarchy you added to the Essbase model and in the center pane of the general tab should be the attributes settings section.
    If I had a dimension called stores wth two groupings unser it region and store_type, I would click on store_type and add the attribute info

  • How to create a Time Dimension

    Hi
    This is regarding a new topic which i could not find the answer in this forum.
    Actually i want to create a time dimension to populate my source data which is in date/time format.
    can anyone please reply back reagrding how to create a time dimension in ODI???
    regards
    Gourisankar

    Hi Gourisankar,
    I am not aware of time dimension. But when i searched in metalink i got the below note. I am not sure whether it will help you or not but still a small contribution. :)
    The note as follows,
    To create new time dimensions, run the following SQL instructions :
    * Example to generate a calendar between 1999-01-01 and 2007-12-31 one row per day
    SELECT to_date('1999-01-01','YYYY-MM-DD')+rownum
    FROM DUAL
    CONNECT BY
    ROWNUM<=to_date('2007-12-31','YYYY-MM-DD')-to_date('1999-01-01','YYYY- MM-DD');
    * Example for generating a calendar random number
    SELECT DBMS_RANDOM.VALUE
    FROM DUAL
    CONNECT BY ROWNUM<=1000000;
    May be you can create a VIEW out of this query ,reverse it and use that as a source in your interface.
    Try this and let me know.
    Thanks,
    G
    Edited by: Gurusank on Dec 22, 2008 4:19 PM

  • How to create checkbox group and table dynamically?

    HI All
    How to create checkbox group and table dynamically?
    Regards
    Ravi

    hi
    check this links for creating  tables dnamically
    How to Create a table dynamically?
    Re: how to create a table dynamically in webdynpro
    and for checkboxgroup
    IWDTransparentContainer rootContainer =
    (IWDTransparentContainer)view.getElement("RootUIElementContainer");
    IWDCheckBox check = (IWDCheckBox)view.createElement(IWDCheckBox.class,"Check"+k);
    //Here "check"+k k represents a unique value every time u create so that u wont get a duplicate instance
    check.setChecked(false);
    rootContainer.addChild(check);
    or Re: adding checkboxes dynamically

  • How to create a double Y axis bar chart

    I have a table with 3 columns, how to create a double Y axis bar chart with title and scale of one Y axis on one side and the other title on the other side, left and right side of the chart.
    Dec 13 107.9
    Jan 9 106.5
    Feb 11 96.1
    Mar 15 111.5
    Apr 13 106.3
    May 13 101.1
    Jun 14 100.2
    July 18 100.8
    Aug 15 103.4
    Sep 16 108.8
    Thanks a lot!
    Stanley Tam

    Start with chart that looks like a column + line chart with a left & right Y axis. It should be the one on the bottom left. After plotting your two series, go to the chart inspector, series tab, and change the second series from line to column. Go to the Axis tab and choose to show the titles for the Y1 and Y2 axes.

  • HOW TO CREATE NODES IN A TREE DYNAMICALLY

    Hi Experts,
    How to create node in a tree dynamically......
    my requirement is in tree there should be nodes which should contain some applications....
    plz explain clearly na......
    help me in this ......
    waiting for u r response .....
    Regars,
    Shilpa

    Hi shilpa,
    These may help you...
    Re: dynamic generation of Tree UI element
    dynamic programming part in below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/21/ad884118aa1709e10000000a155106/content.htm
    try to search on Tree node creation in below link
    http://www.sap-press.de/download/dateien/1103/sappress_maximizing_web_dynpro_for_java.pdf
    regards,
    Pradeep
    Edited by: pradeep bondla on Jun 26, 2008 3:39 PM

  • How to create a MD form using dynamic page ?

    Rahul and Sharmila,
    You have answered several of my queries earlier and I am thankful for them.
    I have been trying to creating a MD form using dynamic page and I haven't fiqured it out. I need help. You both advised me on creating a simple form using dynamic page. The complexity changes drastically when I have to create a MD form. Has no body ever tried to create a MD form with dynamic page?
    I haven't heard from you anything either. I am stuck with this and I need help urgently. Would you kindly tell me if this is possible and how ? Otherwise, I will stop crying for help on this.
    Thanks for your kind attention.
    Mainak

    Hi,
    I have replied to this in the morning.
    Re: Oracle portal and JSR 168 compliance
    Hope it helps.
    Thanks,
    Sharmila

  • How to create custom BOL object for dynamic query in CRM 7.0

    Hi,
    Could anyone please explain me with steps that how to create the custom BOL object for dynamic query in CRM 7.0, I did it in previous version but its throwing exception when i try to create the object of my dynamic query class. I just defined the entry of my in crmv_obj_btil to create the dynamic query BOL object. do i need to do any other thing also to make it work?
    Regards,
    Kamesh Bathla
    Edited by: Kamesh Bathla on Jul 6, 2009 5:12 PM

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • How to create Node, Attributes and Table Dynamically?

    Hi All,
    How to create node and attributes dynamically, and with this node i want to create table dynamically?? Any related code please?
    Thanks
    Venkat.

    HI
    I guess you are asking the same thing in some other post also .
    use the code as mentioned there also.
    data: wd_node_info type ref to if_wd_context_node_info,
    wd_node type ref to if_wd_context_node,
    lr_container type ref to cl_wd_uielement_container,
    lv_tablename type string,
    lt_db_data type ref to data,
    lr_table type ref to cl_wd_table,
    ls_attribute type wdr_context_attribute_info.
    field-symbols: <lt_data> type any table.
    wd_node_info = wd_context->get_node_info( ).
    CALL METHOD WD_NODE_INFO->ADD_NEW_CHILD_NODE
    EXPORTING
    *STATIC_ELEMENT_TYPE = 'ZDEALER'
    NAME = 'NODE'
    IS_MULTIPLE = ABAP_TRUE
    IS_INITIALIZE_LEAD_SELECTION = ABAP_FALSE
    RECEIVING
    CHILD_NODE_INFO = wd_node_info.
    wd_node = wd_context->get_child_node( name = 'NODE' ).
    wd_node_info = WD_node->GET_NODE_INFO( ).
    data dyn_attr_info type wdr_context_attribute_info.
    DYN_ATTR_INFO-NAME = 'X1'. "Attribute Name
    DYN_ATTR_INFO-TYPE_NAME = 'STRING' ." Data Element(CHAR20) ( Type Of Attribute )
    DYN_ATTR_INFO-NODE_INFO = wd_node_info.
    CALL METHOD wd_node_info->ADD_ATTRIBUTE
    EXPORTING
    ATTRIBUTE_INFO = DYN_ATTR_INFO.
    DYN_ATTR_INFO-NAME = 'X2'. "Attribute Name
    DYN_ATTR_INFO-TYPE_NAME = 'STRING' ." Data Element(CHAR20) ( Type Of Attribute )
    DYN_ATTR_INFO-NODE_INFO = wd_node_info.
    CALL METHOD wd_node_info->ADD_ATTRIBUTE
    EXPORTING
    ATTRIBUTE_INFO = DYN_ATTR_INFO.
    lr_container ?= view->get_root_element( ).
    cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
    " Creating internal table with the same structure as our dynamic context node
    CALL METHOD CL_WD_table=>new_table
    EXPORTING
    bind_data_source = 'NODE'
    ID = 'TABLE'
    RECEIVING
    control = lr_table.
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_table ).
    *lr_table->bind_data_source( path = 'NODE' ).
    data lr_table_col type ref to cl_wd_table_column.
    data lr_table_col1 type ref to cl_wd_table_column.
    data lr_text_view type ref to cl_wd_text_view.
    data lr_input_field type ref to cl_wd_input_field.
    DATA lr_column_name_header TYPE REF TO cl_wd_caption.
    lr_input_field = cl_wd_input_field=>new_input_field(
    bind_value = 'NODE.X1' ID = 'INP' ).
    LR_TABLE_COL = cl_wd_table_column=>new_table_column( id = 'COL1' ).
    lr_table->add_column( the_column = lr_table_col ).
    lr_column_name_header ?= cl_wd_caption=>new_caption( text = 'X1').
    lr_table_col->set_table_cell_editor(
    THE_TABLE_CELL_EDITOR = lr_input_field ).
    lr_table_col->set_header( lr_column_name_header ).
    lr_text_view = cl_wd_text_view=>new_text_view(
    bind_text = 'NODE.X2' ID = 'TXT' ).
    LR_TABLE_COL1 = cl_wd_table_column=>new_table_column( id = 'COL2' ).
    lr_table->add_column( lr_table_col1 ).
    lr_column_name_header ?= cl_wd_caption=>new_caption( text = 'X2').
    lr_table_col1->set_table_cell_editor(
    THE_TABLE_CELL_EDITOR = lr_text_view ).
    lr_table_col1->set_header( lr_column_name_header ).
    lr_container->add_child( lr_table ).
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_table ).
    thanks
    sarbjeet singh

  • How to create popup link in OAF dynamically or declaratively.

    Can anybody please help how to create a link as popUp in OAF dynamically or declaratively?

    Step 1: Create an OAPopupBean. For example:
    OAPopupBean popupBean =(OAPopupBean)createWebBean(pageContext,POPUP_BEAN,null,"myPopup");
    //Set the following properties on the pop-up:
    popupBean.setID("myPopup");
    popupBean.setUINodeName("myPopup");
    String popupRegion= "/oracle/apps/fnd/framework/toolbox/labsolutions/webui/TestEmpDetailsRN" ;
    popupBean.setRegion(popupRegion);
    popupBean.setHeight("130");
    popupBean.setWidth("320");
    popupBean.setTitle("Test");
    popupBean.setType(EMBEDDED_POPUP); /* Embedded type */
    Step 2: Select the item (messageStyledText, image, link, or button) on which you want to enable the pop-up, and set the following properties, as shown in this example:
    OATableBean tableBean = (OATableBean)webBean.findChildRecursive("ResultsTable");
    OAImageBean image = (OAImageBean)webBean.findChildRecursive("UpdateImage");
    image.setPopupEnabled(true);
    image.setPopupRenderEvent("onClick");
    image.setPopupID("myPopup");
    Step 3: Add the pop-up as an indexed child of the region that contains the item on which the pop-up is enabled.
    Note: If you are enabling a pop-up on an item within a classic table, advanced table or HGrid, then you must add the pop-up and the item on which it is enabled to a layout and add the layout as the indexed child of the table.
    In this example, the pop-up is enabled on an image within a table, hence the pop-up is added as a second level indexed child of the table:
    OAStackLayoutBean stackLayoutBean = new OAStackLayoutBean();
    stackLayoutBean.addIndexedChild(popupBean);
    tableBean.addIndexedChild(stackLayoutBean);

  • How to create links and display information dynamically depending on search

    hi everybody
    I have a search textbox in which the user has to give the search string like date of birth. For the search string , records will be retrieved from the database. The number of recordds will vary. Only the names of the corresponding person has to be displayed. Each one will have a hyperlink and on clicking the hyperlink the other information like name,address should be displayed.
    I have displayed the names in JSP. How to create a link for each name and display the other details corresponding to same person? The number of records retrieved will vary depending on the date of birth. Thanks in advance.

    Hi,
    what i had done in my project was, getting the collection of results for the search query i.e By giving the date of birth, you will get the matching names as collection and iterate this collection like
    <%
    Collection nameCollection = (Collection) request.getParameter("NameCollection");
    Iterator ite = nameCollection.iterator();
    String name = "";
    for (int i = nameCollection.size(); i > 0; i--)
    name = iterator.next();
    %>
    <A HREF = "http://MyWebSite/destination.jsp?name = <%name%> "><%name%> </a>
    <%}%>
    For the above code, in Href i am using name in two places. one is for display. i hope you dont have any problem in this
    Another one for getting the information about the particular name. use request.getParamter method in the destination Jsp and do one more DB call by using the input parameter.
    Note: This is working only unique Name. otherwise use HashMap for getting the userId and Name. By passing the userId in the backend we can get the information.
    I hope this will helpful to get out of the issue
    Regards
    Balakrishnan.R

  • How to create Custom LabVIEW Node with Dynamic Pins?

    I am trying to create a new set of LabVIEW nodes that will communicate with a new protocol.
    If it's at all possible, I'd like to make the new nodes similar to other connnectivity nodes (i.e. ActiveX, .NET, etc...). There would be an Open Reference node that pops up a custom dialog when created, a Close Reference node, a Property node that dynamically changes when the reference pin changes, and an Invoke node that dynamically changes when the reference pin changes.
    Is it possible to create such nodes as sub-VI's? If so, then how? If not, then what is the prefered method of doing this?
    Thanks in advance for any help
    VRMan

    The technique to do exactly this is called XNode. It's very difficult, not
    supported or documented, and although they work in >7.1, you have to use
    scripting a lot, and that is not supported in 8.x. The technique used in 7.1
    is also preceded. I would really not recommend it. Search LAVA if you need
    to know more.
    You could do this with XControls. These technique might not do 100% what you
    want, but at least they are supported. Haven't used LabVOOP (search class or
    classes in the LV help, there are instruction tutorials and videos), but I
    think you can't make property nodes and methods. I'm sure XControls can do
    that. Both are advanced stuff...
    A third option is to make an express VI, that is configurable by double
    clicking on it. Don't like to use them myself, and therefore haven't make
    any. I think you need a toolkit to make them.
    Regards,
    Wiebe.

Maybe you are looking for

  • Can't connect my Mac to my Windows 2003 server shares via SMB

    Hello all So my problem is I have my Powerbook running 10.4.7 with all the latest security updates and I cannot connect it to any shares on my Windows 2003 domain controller. Everything was working fine and I could connect to the server with no probl

  • Deletion of production order in ECC / APO

    Hi, It is not possible to set DLFL (Deletion flag) when the order is in CRTD status also when the order is DLV or TECO with no actual cost or open order value . It is happening in both the scenarios when 1. Plan order is created in APO and then conve

  • Image issue when printing

    I use Adobe Acrobat 9 Pro. In my job I am responsible for training materials. I often convert pptx or docx into pdfs and never had a problem with images but now I do. PDFs show as being successful and everything looks good on the screen but once I pr

  • Item Level Security - Performance impacts

    We are planning to use Item Level Security but have read in the help that this means folder caching is not used. This will mean a performance degradtion. Has anyone used Item Level Security and ran into performance problems ? If so any guidelines on

  • EPS vecotor looks awful in Premiere CC. Why?

    The same file worked and displayed well in Premiere CS6. I've opened the project with Premiere CC and the vector EPS appeared rasterized and low res. It displays this way on preview of the video and after exporting the movie. Why is this happening an