Get value from the array based on the HashCode

public static void runJoin(int[][] t1,int[][] t2)
     PrintWriter out=null;
     int rows = 1000;
     int cols = 7;
     int [][] myTable3 = new int[rows][cols];
     int x = 0;
     System.out.print("Running HashJoin:Method loads the "+
     "smaller table in the memory and applies a hashing function "+
     "to common column and stores it in another table. "+
     "The larger table is then read from the file. "+
     "The same hashing function is applied to Col n of the table and a       matching record in the first table is looked up. A match will create a row in Table 3. ");          
//Apply hashing function to smaller table and store it in the memory.
          Integer[] It2 = new Integer[t2.length];
          int [] hashCodest2 = new int[t2.length];
          Hashtable ht = new Hashtable();
          for(int i =0; i <t2.length;i++){
               It2[i] = new Integer(t2[0]);
               hashCodest2[i] = It2[i].hashCode();
               ht.put(new Integer(hashCodest2[i]),It2[i]);
          //Larger table get hashcodes
          Integer It1[] = new Integer[t2.length];
          int [] hashCodest1 = new int[t2.length];          
          for(int j =0; j <t1.length;j++){
               It1[j] = new Integer(t1[j][4]);
               hashCodest1[j] = It1[j].hashCode();               }
          //Based on the hashcode get the value from the Table2;
          try{
out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
          Enumeration e = ht.keys();
               while(e.hasMoreElements())
//How do I get the value from the array based on the HashCode? Do I need to do a loop here???                         
hashCodes1.get(e.nextElement());           
          }catch(Exception e){}

ok I got it......
          //Apply hashing function to smaller table and store it in the memory.
          Integer[] It2 = new Integer[t2.length];
          int [] hashCodest2 = new int[t2.length];
          Hashtable ht = new Hashtable();
          for(int i =0; i <t2.length;i++){
               It2[i] = new Integer(t2[0]);
               hashCodest2[i] = It2[i].hashCode();
               ht.put(new Integer(hashCodest2[i]),It2[i]);
          //Larger table get hashcodes and compare
          Integer It1[] = new Integer[t2.length];
          int [] hashCodest1 = new int[t2.length];          
          Hashtable ht2 = new Hashtable();
          for(int j =0; j <t1.length;j++){
               It1[j] = new Integer(t1[j][4]);
               hashCodest1[j] = It1[j].hashCode();               
               ht2.put(new Integer(hashCodest1[j]),It1[j]);
          //Based on the hashcode get the value from the Table2;
          try{
out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
          Enumeration e = ht.keys();
          Integer t3[] = new Integer[t2.length];
               while(e.hasMoreElements())
                    t3[x] = (Integer) ht2.get(e.nextElement());                
                    x++;
          }catch(Exception e){}

Similar Messages

  • How to get values from the page excpet pagecontext.getparameter

    i have a requirement wherein i am passing paramteres from the "submit" button.but the problem being that,i have multiple rows in my page.what is happening is that my "submit" button is passing the values of the previous row,instead of the current row.this is i think because "commit" gets called later and params are passed before it.
    how do i solve this problem
    or if i can get to get paramteres in a advance table layout,i l be able to achieve my requirement.beacuse in advance table layout,i am not able to do pagecontext.getparameter("---" of the item

    thanks guys,
    i did try working with row refrence but it returns a null only.
    my requirement was that i had update functionality as well as "add new rows" on the same advtbl bean.an whenevr i click on "add new row" and submit,i was always gettin the parameters for the previous row.
    now,i have got a workaround to that,by having a radio button to select rows to update and whenever i click on "add new rows" ,i disable the radio button,and get the handle based on the value from radio group.
    but still row refrence dint work for me.i will appreciate if sum1 can send me the code

  • Selecting random values from an array based on a condition

    Hi All,
    I have a small glitch here. hope you guys can help me out.
    I have an evenly spaced integer array as X[ ] = {1,2,3, ....150}. and I need to create a new array which selects 5 random values from X [ ] , but with a condition that these random values should have a difference of atleast 25 between them.
    for example res [ ] = {2,60,37,110,130}
    res [ ] = {10,40,109,132,75}
    I have been thinking of looping thru the X [ ], and selecting randomly but things look tricky once I sit down to write an algorithm to do it.
    Can anyone think of an approach to do this, any help will be greatly appreciated ...

    For your interest, here is my attempt.
    import java.util.Random;
    public class TestDemo {
        public static void main(String[] args) throws Exception {
            for (int n = 0; n < 10; n++) {
                System.out.println(toString(getValues(5, 25, 150)));
        private final static Random RAND = new Random();
        public static int[] getValues(int num, int spread, int max) {
            if (num * spread >= max) {
                throw new IllegalArgumentException("Cannot produce " + num + " spread " + spread + " less than or equals to " + max);
            int[] nums = new int[num];
            int max2 = max - (num - 1) * spread - 1;
            // generate random offsets totally less than max2
            for (int j = 0; j < num; j++) {
                int next = RAND.nextInt(max2);
                // favour smaller numbers.
                if (max2 > spread/2)
                    next = RAND.nextInt(next+1);
                nums[j] = next;
                max2 -= next;
            // shuffle the offsets.
            for (int j = num; j > 1; j--) {
                swap(nums, j - 1, RAND.nextInt(j));
            // add the spread of 25 each.
            for (int j = 1; j < num; j++) {
                nums[j] += nums[j-1] + spread;
            return nums;
        private static void swap(int[] arr, int i, int j) {
            int tmp = arr;
    arr[i] = arr[j];
    arr[j] = tmp;
    public static String toString(int[] nums) {
    StringBuffer sb = new StringBuffer(nums.length * 4);
    sb.append("[ ");
    for (int j = 0; j < nums.length; j++) {
    if (j > 0) {
    sb.append(", ");
    sb.append(nums[j]);
    sb.append(" ]");
    return sb.toString();

  • Trying to get a value from 1 array based off the ID in another

    Something like this.
    rankGrade = model.rankArray.RANKABBRIVIATION where
    model.rankArray.RANKGRADEID = model.student.RANKGRADEID
    Any suggestions?

    You could use associative arrays, or even better to use XML
    with e4x syntax. See these FB3 help topics:
    Associative arrays
    The E4X approach to XML processing
    myXML.item.(menuName=="small fries").@quantity = "2";

  • Getting values from the table control to the program

    Hi Gurus,
    i created a program for sales order creation to transfer order creation and to insert multiple values i defined my own selection screen by inserting table control before that the code executed succesfully but after inserting the table control it is not creating any documents
    code before inserting table control:-
    REPORT  zcl120_sales_n_delivery.
                      SALES DOCUMENT CREATION
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
    PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
    PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
    *ITEM
    PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
    PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    item-material = p_matnr.
    item-plant = p_plant.
    item-target_qty = p_menge.
    item-target_qu = 'ST'.
    item-item_categ = p_itcat.
    APPEND item.
    itemx-updateflag = 'I'.
    itemx-material = 'X'.
    itemx-plant = 'X'.
    itemx-target_qty = 'X'.
    itemx-target_qu = 'X'.
    itemx-item_categ = 'X'.
    APPEND itemx.
    Fill schedule lines
    lt_schedules_in-itm_number = '000010'.
    lt_schedules_in-sched_line = '0001'.
    lt_schedules_in-req_qty = p_menge.
    APPEND lt_schedules_in.
    Fill schedule line flags
    lt_schedules_inx-itm_number = '000010'.
    lt_schedules_inx-sched_line = '0001'.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
      EXPORTING
        sales_header_in     = header
        sales_header_inx    = headerx
      IMPORTING
        salesdocument_ex    = v_vbeln
      TABLES
        return              = return
        sales_items_in      = item
        sales_items_inx     = itemx
        sales_schedules_in  = lt_schedules_in
        sales_schedules_inx = lt_schedules_inx
        sales_partners      = partner.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
      EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
      WRITE / return-message.
      WRITE: / 'Error in creating document'.
    ELSE.
      COMMIT WORK AND WAIT.
      WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
                      DELIVERY ORDER CREATION
    *PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln LIKE vbap-vbeln,
            posnr LIKE vbap-posnr,
            kwmeng LIKE vbap-kwmeng,
            matnr  LIKE vbap-matnr,
            werks  LIKE vbap-werks,
          END OF t_vbap.
    DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
          WITH HEADER LINE.
    DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
          WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    SELECT vbeln posnr kwmeng matnr werks
           INTO TABLE t_vbap
           FROM vbap
           WHERE vbeln = v_vbeln
    LOOP AT t_vbap.
      t_request-document_numb = t_vbap-vbeln.
      t_request-document_item = t_vbap-posnr.
      t_request-quantity_sales_uom = t_vbap-kwmeng.
      t_request-id = 1.
      t_request-document_type = 'A'.
      t_request-delivery_date      = sy-datum.
      t_request-material = t_vbap-matnr.
      t_request-plant = t_vbap-werks.
      t_request-date = sy-datum.
      t_request-goods_issue_date = sy-datum.
      t_request-goods_issue_time = sy-uzeit.
      APPEND t_request.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
      TABLES
        request      = t_request
        createditems = t_created
        return       = t_return.
    READ TABLE t_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      MESSAGE e208(00) WITH 'Delivery creation error'.
    ENDIF.
    COMMIT WORK.
    READ TABLE t_created INDEX 1.
    WRITE: /  'Delivery Number : ',
             t_created-document_numb.
                      CREATE TRANSFER ORDER
    DATA: w_tanum TYPE ltak-tanum.
    CALL FUNCTION 'L_TO_CREATE_DN'
      EXPORTING
        i_lgnum                          = '010'
        i_vbeln                          = t_created-document_numb
    IMPORTING
       e_tanum                          = w_tanum
    EXCEPTIONS
       foreign_lock                     = 1
       dn_completed                     = 2
       partial_delivery_forbidden       = 3
       xfeld_wrong                      = 4
       ldest_wrong                      = 5
       drukz_wrong                      = 6
       dn_wrong                         = 7
       squit_forbidden                  = 8
       no_to_created                    = 9
       teilk_wrong                      = 10
       update_without_commit            = 11
       no_authority                     = 12
       no_picking_allowed               = 13
       dn_hu_not_choosable              = 14
       input_error                      = 15
       OTHERS                           = 16
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK AND WAIT.
    WRITE: / 'Transfer order number',
           w_tanum.
    Code after inserting table control:-
    REPORT  zcl120_sales_n_delivery.
                      SALES DOCUMENT CREATION
    DATA: p_auart TYPE auart .
    DATA: p_vkorg TYPE vkorg .
    DATA: p_vtweg TYPE vtweg .
    DATA: p_spart TYPE vtweg .
    DATA: p_sold TYPE kunnr .
    DATA: p_ship TYPE kunnr .
    *ITEM
    data:
    begin of it_item occurs 0,
       p_matnr TYPE matnr,
       p_menge TYPE kwmeng,
       p_plant TYPE werks_d,
       p_itcat TYPE pstyv,
    end of it_item.
    DATA DECLARATIONS.
    DATA: v_vbeln LIKE vbak-vbeln.
    DATA: header LIKE bapisdhead1.
    DATA: headerx LIKE bapisdhead1x.
    DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
    DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
    DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
    WITH HEADER LINE.
    DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
    WITH HEADER LINE.
    DATA:
      W_COUNTER TYPE I,
      IT_NUM(6) TYPE C value '000010',
      IT_LINE(4) TYPE C value '0001'.
      CALL SCREEN 100.
    HEADER DATA
    header-doc_type = p_auart.
    headerx-doc_type = 'X'.
    header-sales_org = p_vkorg.
    headerx-sales_org = 'X'.
    header-distr_chan = p_vtweg.
    headerx-distr_chan = 'X'.
    header-division = p_spart.
    headerx-division = 'X'.
    headerx-updateflag = 'I'.
    partner-partn_role = 'AG'.
    partner-partn_numb = p_sold.
    APPEND partner.
    partner-partn_role = 'WE'.
    partner-partn_numb = p_ship.
    APPEND partner.
    loop at it_item.
    CLEAR ITEM.
    item-material = it_item-p_matnr.
    item-plant = it_item-p_plant.
    item-target_qty = it_item-p_menge.
    item-target_qu = 'ST'.
    item-item_categ = it_item-p_itcat.
    APPEND item.
    W_COUNTER = W_COUNTER + 1.
    endloop.
    DO W_COUNTER TIMES.
    itemx-updateflag = 'I'.
    itemx-material = 'X'.
    itemx-plant = 'X'.
    itemx-target_qty = 'X'.
    itemx-target_qu = 'X'.
    itemx-item_categ = 'X'.
    APPEND itemx.
    ENDDO.
    Fill schedule lines
    LOOP AT IT_ITEM.
    CLEAR lt_schedules_in.
    lt_schedules_in-itm_number = IT_NUM.
    lt_schedules_in-sched_line = IT_LINE.
    lt_schedules_in-req_qty = IT_ITEM-p_menge.
    APPEND lt_schedules_in.
    IT_NUM = IT_NUM + 10.
    IT_LINE = IT_LINE + 1.
    ENDLOOP.
    IT_NUM = '000010'.
    IT_LINE = '0001'.
    Fill schedule line flags
    LOOP AT IT_ITEM.
    CLEAR lt_schedules_inx.
    lt_schedules_inx-itm_number = IT_NUM.
    lt_schedules_inx-sched_line = IT_LINE.
    lt_schedules_inx-updateflag = 'X'.
    lt_schedules_inx-req_qty = 'X'.
    APPEND lt_schedules_inx.
    IT_NUM = IT_NUM + 10.
    IT_LINE = IT_LINE + 1.
    ENDLOOP.
    Call the BAPI
    CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
      EXPORTING
        sales_header_in     = header
        sales_header_inx    = headerx
      IMPORTING
        salesdocument_ex    = v_vbeln
      TABLES
        return              = return
        sales_items_in      = item
        sales_items_inx     = itemx
        sales_schedules_in  = lt_schedules_in
        sales_schedules_inx = lt_schedules_inx
        sales_partners      = partner.
    LOOP AT return WHERE type = 'E' OR type = 'A'.
      EXIT.
    ENDLOOP.
    IF sy-subrc = 0.
      WRITE / return-message.
      WRITE: / 'Error in creating document'.
    ELSE.
      COMMIT WORK AND WAIT.
      WRITE: / 'Document ', v_vbeln, ' created'.
    ENDIF.
                      DELIVERY ORDER CREATION
    *PARAMETERS: p_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln LIKE vbap-vbeln,
            posnr LIKE vbap-posnr,
            kwmeng LIKE vbap-kwmeng,
            matnr  LIKE vbap-matnr,
            werks  LIKE vbap-werks,
          END OF t_vbap.
    DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
          WITH HEADER LINE.
    DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
          WITH HEADER LINE.
    DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
    SELECT vbeln posnr kwmeng matnr werks
           INTO TABLE t_vbap
           FROM vbap
           WHERE vbeln = v_vbeln
    LOOP AT t_vbap.
      t_request-document_numb = t_vbap-vbeln.
      t_request-document_item = t_vbap-posnr.
      t_request-quantity_sales_uom = t_vbap-kwmeng.
      t_request-id = 1.
      t_request-document_type = 'A'.
      t_request-delivery_date      = sy-datum.
      t_request-material = t_vbap-matnr.
      t_request-plant = t_vbap-werks.
      t_request-date = sy-datum.
      t_request-goods_issue_date = sy-datum.
      t_request-goods_issue_time = sy-uzeit.
      APPEND t_request.
    ENDLOOP.
    CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
      TABLES
        request      = t_request
        createditems = t_created
        return       = t_return.
    READ TABLE t_return WITH KEY type = 'E'.
    IF sy-subrc = 0.
      MESSAGE e208(00) WITH 'Delivery creation error'.
    ENDIF.
    COMMIT WORK.
    READ TABLE t_created INDEX 1.
    WRITE: /  'Delivery Number : ',
             t_created-document_numb.
                      CREATE TRANSFER ORDER
    DATA: w_tanum TYPE ltak-tanum.
    CALL FUNCTION 'L_TO_CREATE_DN'
      EXPORTING
        i_lgnum                          = '010'
        i_vbeln                          = t_created-document_numb
    IMPORTING
       e_tanum                          = w_tanum
    EXCEPTIONS
       foreign_lock                     = 1
       dn_completed                     = 2
       partial_delivery_forbidden       = 3
       xfeld_wrong                      = 4
       ldest_wrong                      = 5
       drukz_wrong                      = 6
       dn_wrong                         = 7
       squit_forbidden                  = 8
       no_to_created                    = 9
       teilk_wrong                      = 10
       update_without_commit            = 11
       no_authority                     = 12
       no_picking_allowed               = 13
       dn_hu_not_choosable              = 14
       input_error                      = 15
       OTHERS                           = 16
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK AND WAIT.
    WRITE: / 'Transfer order number',
           w_tanum.
    *&SPWIZARD: DECLARATION OF TABLECONTROL 'TAB_CON1' ITSELF
    CONTROLS: TAB_CON1 TYPE TABLEVIEW USING SCREEN 0100.
    *&SPWIZARD: OUTPUT MODULE FOR TC 'TAB_CON1'. DO NOT CHANGE THIS LINE!
    *&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR
    MODULE TAB_CON1_CHANGE_TC_ATTR OUTPUT.
      DESCRIBE TABLE IT_ITEM LINES TAB_CON1-lines.
    ENDMODULE.
    *&      Module  STATUS_0100  OUTPUT
          text
    module STATUS_0100 output.
       SET PF-STATUS 'MENU'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module USER_COMMAND_0100 input.
    IF SY-UCOMM EQ 'START'.
    LEAVE to screen 0 .
    ENDIF.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Module  APPEND_IT_ITEM  INPUT
          text
    module APPEND_IT_ITEM input.
    APPEND IT_ITEM.
    CLEAR IT_ITEM.
    endmodule.                 " APPEND_IT_ITEM  INPUT
    plz help me where the error is

    Hi,
    Do same as suggested by Ramesh. Add one user command button after clicking that do the looping and call new screen.
    Ashven.

  • Getting values from the dynamically created textboxes

    Hello,
    I am developing one jsp page using struts. In the page i m
    dynamically adding some rows with 2 textboxes in each row. and
    after entering data into those rows , user clicks on save button
    and page is submitted. I want to capture all this data of dynamically
    added rows so that i can enter those rows into DB.
    how can i acheive this using struts?.
    Have anyone had tried doing it?. Please help.
    Thanx in advance
    Deepali Naik

    U can do something like......
    class MatrixData{
    public myMethod(){
    Arraylist list_of_rows=new Arraylist ();
    JTextBox 11=new JTextBox (); // matrix position (1,1)
    JTextBox 12=new JTextBox ();// matrix position (1,2)
    addRow(new RowData(11,12)
    public addRow(RowData data){
    list_of_rows.add(data);
    class RowData{
    Arraylist txtBoxList=new Arraylist ();
    public JTextBox getOne(){
    return txtBoxList.get(0);
    public JTextBox getTwo(){
    return txtBoxList.get(1);
    public setOne(JTextBox comp){
    txtBoxList.add(comp);
    public setTwo(JTextBox comp){
    txtBoxList.add(comp);
    Hope it helps.
    Best Regards
    Mohit

  • Help needed in getting values from the dynamically created text boxes

    Hello,
    I am developing one jsp page using struts. In the page i m
    dynamically adding some rows with two text boxes in each row. and after entering data into
    those textboxes , user clicks on save button and page is submitted.
    I want to capture all this data of dynamically added
    rows so that i can enter those rows into DB.
    how can i acheive this using struts?.
    Have anyone had tried doing it?. Please help.
    Thanx in advance
    Deepali Naik

    Hi,
    1. If you give these textBoxes the same name, then in your action you can call request.getParameterValues(paramName) - it returns String[ ] of values.
    2. You can give form textBox names like "name"+index or something like this in <logic:iterate> tag
    Good luck!

  • How to get value from a metric based on date, without effecting other colum

    Hi
    I have 2 metrics say Revenue and Total Revenue and Date Dim
    For a selected date in the prompt, Revenue should be shown for that date, where as Total Revenue should be shown for the past 15 days, based on the date in the prompt.
    How can I achieve this?
    Cheers
    Edited by: OBIAS on Feb 28, 2013 4:57 PM

    Set a presentation variable in the Date Dim prompt, P_DATE.
    Within the request, edit the formula for Revenue to be...
    FILTER("Revenue" USING ("Date" = @{P_DATE}))
    And set the formula for Total Revenue to be something like...
    FILTER("Total Revenue" USING ("Date" between TimestampAdd(SQL_TSI_DAY, -15, @{P_DATE}) and @{P_DATE}))
    JB

  • How to get values from an IFrame...

    Hi everyone. I have come to a complete stop i my project and need to ask the following: How do i get the values from an IFrame.
    Situation: I have a main.jsp page that contains an IFrame(data.jsp). Data.jsp is basically made up of a bunch of checkboxes. The state of these boxes(checked or unchecked) is determined and set by a JAVA program and the results are then stored in a StringBuffer. Contents of Stringbuffer could look something like this: <tr><input type='checkbox' name='box0' CHECKED></tr>.
    The StringBuffer in then presented in the IFrame(data.jsp) like so: <%=res.getInfo()%>
    The user should be able to check or uncheck the boxes from the main.jsp page then when pressing a submit button the changes should be stored in a DBase.
    After the submit button have been pressed i go into my Servlet's doPost() method for some basic processing. This is were the problem starts. I usally use HttpServletRequest.getParameter(String param) to get values from the main.jsp page. But these checkboxes are stored in the IFrame, so how do i go about to retrieve the values from data.jsp from the doPost() method or in some other way maybe. This is quite urgent and i hope that i have explained the scenario in enough detail.
    Any help would be greatlly apritiated.
    Best regards
    Peter

    Hello
    Just try this link
    http://www.faqts.com/knowledge_base/view.phtml/aid/13758/fid/53
    HTH

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • How to get all the values from the dropdown menu

    How to get all the values from the dropdown menu
    I need to be able to extract all values from the dropdown menu; I know how to get all those values as a string, but I need to be able to access each item; (the value in a dropdown menu will change dynamically)
    How do I get number of item is selection dropdown?
    How do I extract a ?name? for each value, one by one?
    How do I change a selection by referring to particular index of the item in a dropdown menu?
    Here is the Path to dropdown menu that I'm trying to access (form contains number of similar dropdowns)
    RSWApp.om.GetElementByPath "window(index=0).form(id=""aspnetForm"" | action=""advancedsearch.aspx"" | index=0).formelement[SELECT](name=""ctl00$MainContent$hardwareBrand"" | id=""ctl00_MainContent_hardwareBrand"" | index=16)", element
    Message was edited by: testtest

    The findElement method allows various attributes to be used to search. Take the following two examples for the element below:
    <Select Name=ProdType ID=testProd>
    </Select>
    I can find the element based on its name or any other attribute, I just need to specify what I am looking for. To find it by name I would do the following:
    Set x = RSWApp.om.FindElement("ProdType","SELECT","Name")
    If I want to search by id I could do the following:
    Set x = RSWApp.om.FindElement("testProd","SELECT","ID")
    Usually you will use whatever is available. Since the select element has no name or ID on the Empirix home page, I used the onChange attribute. You can use any attribute as long as you specify which one you are using (last argument in these examples)
    You can use the FindElement to grab links, text boxes, etc.
    The next example grabs from a link on a page
    Home
    Set x = RSWApp.om.FindElement("Home","A","innerText")
    I hope this helps clear it up.

  • How to get the selected values from the shuttle

    Hi
    Please tell me how to get the selected option values from the shuttle leading list.
    Thanks

    you can also obtain the option values present in the leading and trailing lists using the
    following methods:
    public String[] getLeadingListOptionValues(OAPageContext pageContext, OAWebBean
    webBean)
    public String[] getTrailingListOptionValues(OAPageContext pageContext, OAWebBean
    webBean)For example, the following code sample returns an array of values in the trailing list, ordered according to the
    order in which they appear in the list:
    String[] trailingItems =
    shuttle.getTrailingListOptionValues(pageContext, shuttle);Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Finding the smallest value from an array

    Hi there :)
    I started learning Java a few days ago and have now run into my first problem :p
    I am using Netbeans on Mac OS X.
    I need to find the smallest value from an array. So far I've had no luck. Any suggestions would be fantastic.
    The code so far:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
            int O = A.length - 3;
            int B = A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7] + A[8] + A[9] + A[10] + A[11] + A[12] + A[13] + A[14];
            A[15] = B;  // Stores the sum of the integers in A[15]
            int C = B / O;
            A[16] = C;  // Computes and stores the average in A[16]
            int D = 101;
                if (A[0] < A[1]) { D = A[0]; }
                else { D = A[1]; }
                if (A[1] < A[2]) { D = A[1]; }
                else { D = A[2]; }
            System.out.println("There are " + O + " numbers in the Array");
            System.out.println("Those numbers add up to " + B + ".");
            System.out.println("The average of those numbers is " + C + ".");
            System.out.println("The smallest value in the array is " + D + ".");
    }The code is incomplete, but it works so far. The problem is I know there must be an easier way. SAVE ME :)

    OK :)
    Just thought I should show you the output as to help anyone else with the same problem:
    * Math Problems
    * Created on May 4, 2007, 10:54 AM
    * PROJECT 1: - IN PROGRESS
    * Create a program that allows you to create an integer array of 18 elements with the following values
    * 3, 2, 4, 5, 6, 4, 5, 7, 3, 2, 3, 4, 7, 1, 2, 0, 0, 0
    *  - The program computes the sum of elements 0 to 14 and stores it in element 15                              // COMPLETED
    *  - The program computes the average and stores it in element 16                                              // COMPLETED
    *  - The program finds the smallest value from the array and stores it in element 17                           // COMPLETED
    * PROJECT 2: - TO DO
    * Write a program that accepts from the command line and prints them out. Then use a for loop to print
    * the next 13 numbers in the sequence where each number is the sum of the previous two. FOR EXAMPLE:
    *  - input>java prob2 1 3
    *  - output>1 3 4 7 11 18 29 47 76 123 322 521 843 1364
    * PROJECT 3: - TO DO
    * Write a program that accepts from the command line two numbers in the range from 1 to 40. It then
    * compares these numbers against a single dimension array of five integer elements ranging in value
    * from 1 to 40. The program displays the message BINGO if the two inputted values are found in the array
    * element. FOR EXAMPLE:
    *  - input>java prob3 3 29
    *  - output>Your first number was 3
    *  -        Your second number was 29
    *  -        Its Bingo!  // This message if 3 and 29 are found in the array
    *  -        Bokya!      // This message if 3 and 29 are not found in the array
    *  -        The array was 7 5 25 5 19 30
    * PROJECT 3 EXTENSION: - OPTIONAL
    * Generate the array of 5 unique integers using random numbers
    package mathproblems;
    * @author Mohammad Ali
    import java.util.Arrays;
    public class Main { 
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
         public static void main(String[] args) {
                  int A[]={3,2,4,5,6,4,5,7,3,2,3,4,7,1,2,0,0,0};
              Arrays.sort(A);
              System.out.println("The smallest value in the array is " + A[0] + ".");
              int num = A.length;
              System.out.println("There are " + num + " values in the Array.");
              int sum = 0;
              for (int i = 0; i < A.length; i++) {
                   sum+=A;
              System.out.println("Those numbers add up to " + sum + ".");
              double d = (double)sum/num;
              System.out.println("The average value of those numbers is " + d + ".");
    What Iearned:
    1) How to create for loops properly
    2) How to import java.util.Arrays ( =D )
    3) How to get a more accurate average using double instead of int
    4) This forum is the best and has very helpful people 24/7 ( =D)
    Thanks Again,
    Mo.

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

Maybe you are looking for