Formatting a two-dimensional list...

Is there a way to create a two-dimensional ArrayList of Integers with all cells containing certain values, for example zeros? -I will be storing changing Integer values in certain x- and y-coordinates!!
Something like:
ArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>();But my problem is that the .get commands cause an Exception if a cell value is not set:
list.get(x).get(y) and list.get(x).set(y,int)How could I get around the "null" values without Exceptions? Would you first replace the null values with zeros? (Or is there some other way to store such information?)

If you want to a fill a List up with values, use java.util.Collections.fill().
But do you really want it full of some kind of value, or do you just want to indicate "no value filled in" for a bunch of positions in the grid? What percentage of positions will not be filled in, or will be filled in with the default?
Here's a simple sparse grid:
public class Pair {
  final int x;
  final int y;
  public boolean equals(Object o) {
    Pair p = (Pair) o;
    return p.x == x && p.y == y;
  public int hashcode() {
    return x + y;
public class SparseGrid {
  private Map<Pair, Integer> grid = new HashMap<Pair, Integer>();
  public Integer get(Pair p) {
    Integer i = grid.get(p);
    if (i == null)
      return 42; // the default.  or just skip this test if you don't want a default
    return i;
  // also a put method, left as exercise
}That's all untested.

Similar Messages

  • Two Dimensional  and Multidimensional

    Hi experts,
    What is  Two Dimensional  and Multidimensional , i want exactly the diff between these two ? Generally we are saying that cube is Multidimensional  and ODS is Two Dimensional ?
    I willl asssign points for ur valuable answers .

    Hi Nagireddy,
    ODS is 2 dimensional format and it is not good to analyze the data in multi dimensional way.If you want to take flat reporting then go for ODS reporting. TheTwo dimensional report is similar to reporting on a table.ODS active table is a flat table like an r/3 table. Reporting is done on active table of ODS. other tables are for handling the deltas.
    List of purchase orders for a vendor is two dimensional report whereas sales organisationwise, sales areawise,customerwise sales for last quarter and comparison with earlier quarters is a multi-dimensional report.
    Cube is multidimensional formate and you can analyze data in different dimensions,so if your requirement is multidimensional report go for Cube.
    Hope this helps,
    Regards
    CSM Reddy

  • Reg: Combining two display lists into one list

    Dear All,
    i want to combine two display lists into one display list. Please give the idea for this one issue.
    *****************dispaly list 1 starting here*********************
    *&      Form  F_006_DISPLAY_LIST
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM F_006_DISPLAY_LIST.
    *  TABLES : LFA1 .
      DATA : V_DEBIT_TOTAL TYPE P DECIMALS 2 ,
             V_CREDIT_TOTAL TYPE P DECIMALS 2 ,
             V_CLOSE_BAL TYPE P DECIMALS 2 .
      DATA : V_CNT TYPE I .
      SORT ITAB_OPG BY LIFNR.
      LOOP AT ITAB_OPG.
        NEW-PAGE.
    * Displaying Vendor Name
        SELECT SINGLE NAME1 FROM LFA1 INTO LFA1-NAME1 WHERE
                                                 LIFNR EQ ITAB_OPG-LIFNR .
        FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
        WRITE:/2 'Vendor Code:' ,
                 ITAB_OPG-LIFNR  ,
              40 LFA1-NAME1 .
        CLEAR : LFA1 .
        WRITE :/(190) SY-ULINE .
    * Displaying Opening Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
        READ TABLE ITAB_OPG WITH KEY LIFNR = ITAB_OPG-LIFNR .
        IF ITAB_OPG-BAL LE 0 .
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  171(18) ITAB_OPG-BAL .
        ELSE.
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  151(18) ITAB_OPG-BAL .
        ENDIF.
        WRITE :/(190) SY-ULINE .
    * Displaying Line Items
        LOOP AT ITAB_DISPLAY WHERE LIFNR EQ ITAB_OPG-LIFNR.
          V_CNT = SY-TABIX MOD 2.
          IF V_CNT EQ 0.
            FORMAT COLOR COL_NORMAL INTENSIFIED ON.
          ELSE.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
          ENDIF.
    * Selecting Bank Name and Cheque Number
          SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
                               FROM PAYR WHERE
                        ZBUKR EQ P_BUKRS AND
                        VBLNR EQ ITAB_DISPLAY-BELNR AND
                        LIFNR EQ ITAB_DISPLAY-LIFNR .
          SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
                 T012 WHERE BUKRS EQ P_BUKRS AND
                            HBKID EQ PAYR-HBKID.
          SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
                            BANKS EQ T012-BANKS AND
                            BANKL EQ T012-BANKL .
          WRITE :/2 ITAB_DISPLAY-BUDAT ,
                 14 ITAB_DISPLAY-BELNR ,
                 26 ITAB_DISPLAY-BLDAT ,
                 40 ITAB_DISPLAY-XBLNR ,
                 58(16) PAYR-CHECT ,
                 75 BNKA-BANKA ,
                105(40) ITAB_DISPLAY-SGTXT ,
                146(4) ITAB_DISPLAY-BLART .
    * Determinig Debit or Credit
          IF ITAB_DISPLAY-SHKZG EQ 'S'.
            V_DEBIT_TOTAL = V_DEBIT_TOTAL + ITAB_DISPLAY-DMBTR.
            WRITE:151(18)  ITAB_DISPLAY-DMBTR ,
                  171(18)  SPACE .
          ELSEIF ITAB_DISPLAY-SHKZG EQ 'H'.
            V_CREDIT_TOTAL = V_CREDIT_TOTAL + ITAB_DISPLAY-DMBTR.
            WRITE:151(18) SPACE ,
                  171(18)  ITAB_DISPLAY-DMBTR .
          ENDIF.
          CLEAR : T012 , BNKA , PAYR .
        ENDLOOP.
        FORMAT COLOR COL_TOTAL INTENSIFIED ON.
        WRITE:/(190) SY-ULINE.
    * Displaying Debit and Credit Totals
        WRITE:/125 TEXT-001 ,
           151(18) V_DEBIT_TOTAL ,
           171(18) V_CREDIT_TOTAL .
        WRITE:/(190) SY-ULINE.
    * Displaying the Closing Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        V_CLOSE_BAL = ITAB_OPG-BAL + V_DEBIT_TOTAL - V_CREDIT_TOTAL .
        IF V_CLOSE_BAL GT 0.
          WRITE:/122 TEXT-002 ,
             151(18) V_CLOSE_BAL NO-SIGN.  " D00K909674
        ELSEIF V_CLOSE_BAL LE 0.
          WRITE:/122 TEXT-002 ,
             171(18) V_CLOSE_BAL NO-SIGN.  " D00K909674
        ENDIF.
        CLEAR : V_CLOSE_BAL.
      ENDLOOP.
    ENDFORM.                               " F_006_DISPLAY_LIST
    *****************dispaly list 1 ending here*********************
    *****************dispaly list 2 starting here*********************
    *&      Form  F_006_DISPLAY_LIST1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM F_006_DISPLAY_LIST1 .
    TABLES : KNA1 .
      DATA : V_DEBIT_TOTAL1 TYPE P DECIMALS 2 ,
             V_CREDIT_TOTAL1 TYPE P DECIMALS 2 ,
             V_CLOSE_BAL1 TYPE P DECIMALS 2 .
      DATA : V_CNT1 TYPE I .
      SORT ITAB_OPG1 BY KUNNR.
      LOOP AT ITAB_OPG1.
        NEW-PAGE.
    * Displaying Vendor Name
        SELECT SINGLE NAME1 FROM KNA1 INTO KNA1-NAME1 WHERE
                                                 KUNNR EQ ITAB_OPG1-KUNNR .
        FORMAT COLOR COL_POSITIVE INTENSIFIED ON.
        WRITE:/2 'Customer Code:' ,
                 ITAB_OPG1-KUNNR  ,
              40 KNA1-NAME1 .
        CLEAR : KNA1 .
        WRITE :/(190) SY-ULINE .
    * Displaying Opening Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON .
        READ TABLE ITAB_OPG1 WITH KEY KUNNR = ITAB_OPG1-KUNNR .
        IF ITAB_OPG1-BAL1 LE 0 .
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  171(18) ITAB_OPG1-BAL1 .
        ELSE.
          WRITE :/2 'Opening Balance for Period' , (4) S_MONAT-LOW , ':' ,
                  151(18) ITAB_OPG1-BAL1 .
        ENDIF.
        WRITE :/(190) SY-ULINE .
    * Displaying Line Items
        LOOP AT ITAB_DISPLAY1 WHERE KUNNR EQ ITAB_OPG1-KUNNR.
          V_CNT1 = SY-TABIX MOD 2.
          IF V_CNT1 EQ 0.
            FORMAT COLOR COL_NORMAL INTENSIFIED ON.
          ELSE.
            FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
          ENDIF.
    * Selecting Bank Name and Cheque Number
          SELECT SINGLE CHECT HBKID INTO (PAYR-CHECT , PAYR-HBKID)
                               FROM PAYR WHERE
                        ZBUKR EQ P_BUKRS AND
                        VBLNR EQ ITAB_DISPLAY1-BELNR AND
                        KUNNR EQ ITAB_DISPLAY1-KUNNR .
          SELECT SINGLE BANKS BANKL INTO (T012-BANKS , T012-BANKL) FROM
                 T012 WHERE BUKRS EQ P_BUKRS AND
                            HBKID EQ PAYR-HBKID.
          SELECT SINGLE BANKA INTO BNKA-BANKA FROM BNKA WHERE
                            BANKS EQ T012-BANKS AND
                            BANKL EQ T012-BANKL .
          WRITE :/2 ITAB_DISPLAY1-BUDAT ,
                 14 ITAB_DISPLAY1-BELNR ,
                 26 ITAB_DISPLAY1-BLDAT ,
                 40 ITAB_DISPLAY1-XBLNR ,
                 58(16) PAYR-CHECT ,
                 75 BNKA-BANKA ,
                105(40) ITAB_DISPLAY1-SGTXT ,
                146(4) ITAB_DISPLAY1-BLART .
    * Determinig Debit or Credit
          IF ITAB_DISPLAY1-SHKZG EQ 'S'.
            V_DEBIT_TOTAL1 = V_DEBIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
            WRITE:151(18)  ITAB_DISPLAY1-DMBTR ,
                  171(18)  SPACE .
          ELSEIF ITAB_DISPLAY1-SHKZG EQ 'H'.
            V_CREDIT_TOTAL1 = V_CREDIT_TOTAL1 + ITAB_DISPLAY1-DMBTR.
            WRITE:151(18) SPACE ,
                  171(18)  ITAB_DISPLAY1-DMBTR .
          ENDIF.
          CLEAR : T012 , BNKA , PAYR .
        ENDLOOP.
        FORMAT COLOR COL_TOTAL INTENSIFIED ON.
        WRITE:/(190) SY-ULINE.
    * Displaying Debit and Credit Totals
        WRITE:/125 TEXT-001 ,
           151(18) V_DEBIT_TOTAL1,
           171(18) V_CREDIT_TOTAL1 .
        WRITE:/(190) SY-ULINE.
    * Displaying the Closing Balance
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        V_CLOSE_BAL1 = ITAB_OPG1-BAL1 + V_DEBIT_TOTAL1 - V_CREDIT_TOTAL1 .
        IF V_CLOSE_BAL1 GT 0.
          WRITE:/122 TEXT-002 ,
             151(18) V_CLOSE_BAL1 NO-SIGN.  " D00K909674
        ELSEIF V_CLOSE_BAL1 LE 0.
          WRITE:/122 TEXT-002 ,
             171(18) V_CLOSE_BAL1 NO-SIGN.  " D00K909674
        ENDIF.
        CLEAR : V_CLOSE_BAL1.
      ENDLOOP.
    ENDFORM.                    " F_006_DISPLAY_LIST1
    *****************dispaly list 2 ending here*********************
    Thanks,
    Sankar M

    Hi,
    Can you post it as two halves ?
    Regards,
    Swarna Munukoti

  • Two dimensional Grouping

    Hi 2 all,
    I'm trying to build a report starting from two complex PL/SQL query like this(simplified):
    SELECT SUM(x),SUM(y),SUM(z),Name,type,product
    FROM DESC A, STORE1 B, STORE2 C, store3 D, store4 E
    WHERE b.ID=c.ID(+)
    AND b.ID=d.ID(+)
    AND b.ID=e.ID(+)
    AND a.code=b.code
    AND a.product='oneproduct'(...another query with !='oneproduct')
    group by b.Name,b.type
    I need to have on each report page the results of the two queries grouped by type, one page for each (Name).
    how can I have the content of Name field on the header/margin (as a title) and the remainder data below grouped by the same Name?
    =&gt; In the end I should have one page for each Name
    thanks
    Matteo

    On the other hand I do recall having read somewhere
    that the "new" operator
    is very costly and should strictly be
    avoided in loops.Not that expensive performance-wise. It could potentially suck up a lot of memory if you are creating LOTS of objects
    Now for the concrete case of reading some user's
    datasets from a database
    and then processing them further, is it advisable
    to instantiate a new user object for each row, or
    where is the alternative
    to be found?I think you should create an object to represent each row.
    two dimensional collections (any favourites in java)I always create my own. I try to use Vectors and Hashtables exclusively, depending on my needs re: ordering and lookup. Mixing and matching these could result in Vectors of Hashtables, Vectors of Vectors, Hashtables of Vectors, and Hashtables of Hashtables.
    synchronized one dimensional collections each
    representing one field in a
    table ? (is this really more performant than simple
    classes)Doubtful - any gain that you get by avoiding the constructor call would be obviated by the overhead of iterating through multiple lists and keeping them synchronized.
    a Collection of Collections (here comes the new
    operator again)Same as two-dimensional collections.
    I remember having seen inner classes used for the
    purpose of holding just a
    couple of attributes, is there some performance
    advantage like "the class
    loader does not have to look for the class".No advantage - the only reason to create an inner class is to prevent other classes from using those objects. The inner class still compiles to a separate class object that needs to be loaded separately.

  • Check duplicate items in two sharepoint lists

    Hi, I have 2 separate sharepoint lists, both contrain user names. e.g: Jan Jaap.
    I want sharepoint to automaticly compare those lists to see if there is any name in both lists and notify me about it. For example :
    List 1: Firstname | Surname
              Jan           -    Jaap
              Steen        -    Vos
              george       -    bush
    List 2: Firstname | Surname
              Jan           -    Jaap
              fox            -    washington
              brian         -    potter
    both lists contain jan jaap. and i want sharepoint to notice that and send me and email about it :p.
    Is this in any way possible?
    Thanks in advance!!

    You can use below tool
    http://www.metalogix.com/help/Content%20Matrix%20Console/SharePoint%20Edition/002_HowTo/004_SharePointActions/003_CompareSitesAndLists.htm
    Or if you want to do it programmatic try below:
    http://sharepoint.stackexchange.com/questions/60917/compare-items-of-two-sharepoint-lists
    SPWeb web = SPContext.Current.Web;
    SPList list = web.Lists["Employee"];
    string query = @"<Where>
    <Eq>
    <FieldRef Name='Position' /><Value Type='Choice'>{0}</Value>
    </Eq>
    </Where>
    <OrderBy>
    <FieldRef Name='Salary' Ascending='False' />
    </OrderBy>";
    query = string.Format(query, "Developer");
    SPQuery spQuery = new SPQuery();
    spQuery.Query = query;
    SPListItemCollection items = list.GetItems(spQuery);
    If this helped you resolve your issue, please mark it Answered

  • Sorting a two dimensional array in descending order..

    Guy's I'm a beginning Java programmer. I've been struggling with finding documentation on sorting a two dimensional primitive array in descending order.. The following is my code which goes works, in ascending order. How do I modify it to make the list write out in descending order?
    class EmployeeTable
         public static void main(String[] args)
         int[][] hours = {
              {2, 4, 3, 4, 5, 8, 8},
              {7, 3, 4, 3, 3, 4, 4},
              {3, 3, 4, 3, 3, 2, 2},
              {9, 3, 4, 7, 3, 4, 1},
              {3, 5, 4, 3, 6, 3, 8},
              {3, 4, 4, 6, 3, 4, 4},
              {3, 7, 4, 8, 3, 8, 4},
              {6, 3, 5, 9, 2, 7, 9}};
         int [] total = new int [hours.length];
         for (int i = 0; i < hours.length ; i++){
              for (int j = 0; j < hours.length ; j++){
                   total[i] += hours[i][j];
         int[] index = new int[hours.length];
         sortIndex(total, index);
    for (int i = 0; i < hours.length; i++)
    System.out.println("Employee " + index[i] + " hours are: " +
    total[i]);
    static void sortIndex(int[] list, int[] indexList) {
    int currentMax;
    int currentMaxIndex;
    for (int i = 0; i < indexList.length; i++)
    indexList[i] = i;
    for (int i = list.length - 1; i >= 1; i--) {
    currentMax = list[i];
    currentMaxIndex = i;
    for (int j = i - 1; j >= 0; j--) {
    if (currentMax < list[j]) {
    currentMax = list[j];
    currentMaxIndex = j;
    // How do I make it go in descending order????
    if (currentMaxIndex != i) {
    list[currentMaxIndex] = list[i];
    list[i] = currentMax;
    int temp = indexList[i];
    indexList[i] = indexList[currentMaxIndex];
    indexList[currentMaxIndex] = temp;

    Bodie21 wrote:
    nclow all you wrote was
    "This looks to me like a homework assignment that you're asking us to solve for you. Your description of what it does isn't even correct. It doesn't sort a 2d array.
    You would probably elicit better help if you could demonstrate that you've done some work and have something specific that you don't understand."
    To me that sounds completely sarcastic. You didn't mention anything constructive besides that.. Hence I called you a male phalic organ, not a rear exit...Bodie21, OK, now you've got 90% of us who regularly contribute to this forum thinking your the pr&#105;ck. Is that what you wanted to do? If so, mission accomplished. Many will be looking for your name next time you ask for help. Rude enough for you?

  • How can I use two dimensional array ?

    Could some one show me how to use two dimentional array ?
    I am know how to right a single ...but not two dimentional....please help,
    Thanks,
    Flower
    public class Exam5
    public static void main(String[] args)
    int[][] numbers =
         {     {1,2,3,4,5,6,7,8,9,10},
    {1,2,3,4,5,6,7,8,9,10} };
    for(int i = 1; i < 11; ++i)
    System.out.println(i + "\t" + i * 2 + "\t" + i * 3 + "\t" + i * 4 + "\t" + i * 5 +
    "\t" + i * 6 + "\t" + i * 7 + "\t" + i * 8 + "\t" + i * 9 + "\t" + i * 10);
    Display #
    1     2     3     4     5     6     7     8     9     10
    2     4     6     8     10     12     14     16     18     20
    3     6     9     12     15     18     21     24     27     30
    4     8     12     16     20     24     28     32     36     40
    5     10     15     20     25     30     35     40     45     50
    6     12     18     24     30     36     42     48     54     60
    7     14     21     28     35     42     49     56     63     70
    8     16     24     32     40     48     56     64     72     80
    9     18     27     36     45     54     63     72     81     90
    10     20     30     40     50     60     70     80     90     100

    First, try not to ask someone to do your homework for you and then tell them they are wrong. The code posted may not have been exactly what you were looking for, but it was not wrong because it did exactly what the poster said it would do - print out the multiplication table.
    Second, in the future if you ask specific questions rather than posting code and hoping someone will fix it for you, you may one day be able to complete the assignments on your own.
    Here is code that prints what you want and uses a two dimensional array. Please ask questions if you do not understand the code. You will never learn if you just use someone else's code without taking the time to examine or understand it.
    public class MultiTable{  
        public static void main(String[] args)   { 
            int rows = 10;
            int columns = 10;
            int [][] numbers = new int [rows] [columns];
            for(int j = 0; j < rows; j++)   // for each of 10 rows
                for(int k = 0; k < columns; k++)    // for each of 10 columns
                    numbers[j][k] = (j+1) * (k+1);  // calculate row+1 * col+1
            for (int j = 0; j < rows; j++)  // for each of 10 rows
                for (int k = 0; k < columns; k++)   // for each of 10 columns
                    System.out.print(numbers[j][k]+" ");    // print out result
                    if (numbers[j][k] < 10)     // for single digit numbers
                        System.out.print(" ");  // print extra space for better formatting
                System.out.println();       // skip to next line
    }

  • How to extract one dimension out of a two dimensiona​l array

    Hello,
    May be this question is too naive and simple.I have a two dimensional array (two columns and 256 rows). All I want is to extract one of these columns as a separate one dimensional array. It seems like a very very basic task that any programming language should address. However, I could not find the right funciton in the array functions list. I am sure I am missing something very obvious. I tried index array, array subset, array to cluster and reshape array. None of them is the right function for this purpose. I have used LabVIEW for a quite a while now, but still I can not find a solution to this basic problem. Can someone help me out.
    Thanks
    Solved!
    Go to Solution.

    Hi -
    With the Index Array  function have you tried wiring a number to the input labeled index (col)?
    See the attached vi for an example.
    Attachments:
    array index1.vi ‏6 KB

  • Reordering columns of two dimensional matrix

    Hello all,
    How to reorder the columns of a two dimensional matrix as per the conditions given below
    1. The front panel should contain a string  control. when supplied a list of indices of column  in  the string control. The ordering of the columns should be done according to the order list provided .
    2. when  0s are entered in the string control ,  column values of that index should contain 0s.
     please provide a solution or VI  for this . regards
    renault

    I think this VI (7.0) will do what you mean - it creates an array the same size of the original and extracts the columns from the original.
    2 points -
    0 is a problem because in LV (like many other computer languages), 0 is the first element. -1 will do what you wanted instead.
    This assumes space as a seperator between the values in the string. You may wish to have a 1D numeric array instead of the string.
    Try to take over the world!
    Attachments:
    reorder array.vi ‏30 KB

  • Conditional colour formatting in apex_item select list

    Hello all,
    I am having a select list in my tabular report created using apex_item.
    What user want is the colour formatting of this select list according to the condition.
    Say eg: A select list for departments, I want the departments with employees in different colour as compared to departments with no employees.
    Please help.
    Thanks
    Tauceef

    I've got a function in my package for this issue. Maybe it will gives you an idea how to solve this topic. The function is very similar to apex_item.select_list function, but there is a significant different. Displays values and returns values that are separated by two semicolons!
      FUNCTION get_select_list(p_idx NUMBER,
        p_value VARCHAR2 DEFAULT '',
        p_list_value VARCHAR2,
        p_attributes VARCHAR2 DEFAULT '',
        p_show_null VARCHAR2 DEFAULT '',
        p_null_value VARCHAR2 DEFAULT '',
        p_null_text VARCHAR2 DEFAULT '',
        p_item_id VARCHAR2 DEFAULT '') RETURN VARCHAR2 AS
        v_null VARCHAR2(4000);
        v_output VARCHAR2(4000);
        v_value VARCHAR2(4000);
        l_vc_fields htmldb_application_global.vc_arr2;
        l_vc_return_fields htmldb_application_global.vc_arr2;
      BEGIN
        l_vc_fields := HTMLDB_UTIL.string_to_table (p_list_value, ',');
        v_output := '<select name="f' || TRIM(TO_CHAR(p_idx, '09')) || '" ' || p_attributes;
        IF LENGTH(p_item_id) IS NOT NULL THEN
          v_output := v_output || ' id="' || p_item_id || '"';
        END IF;
        v_output := v_output || '>';
        v_null := '<option';
        IF LENGTH(p_null_value) IS NULL THEN
          v_null := v_null || ' value="%null%"';
        ELSE
          v_null := v_null || ' value="' || p_null_value || '"';
        END IF;
        v_null := v_null || '>';
        IF LENGTH(p_null_text) IS NULL THEN
          v_null := v_null || '%';
        ELSE
          v_null := v_null || p_null_text;
        END IF;
        v_null := v_null || '</option>';
        IF UPPER(p_show_null) != 'NO' THEN
          v_output := v_output || v_null;
        END IF;
        FOR i IN 1 .. l_vc_fields.COUNT LOOP
          l_vc_return_fields := HTMLDB_UTIL.string_to_table (l_vc_fields(i), ';;');
          v_output := v_output || '<option';
          IF l_vc_return_fields.COUNT = 2 THEN
            v_value := l_vc_return_fields(2);
          ELSE
            v_value := l_vc_return_fields(1);
          END IF;
          v_output := v_output || ' value="' || v_value || '"';
          IF v_value = p_value THEN
            v_output := v_output || ' selected="selected"';
          END IF;
          IF l_vc_return_fields.COUNT = 3 THEN
            v_output := v_output || ' ' || l_vc_return_fields(3);
          END IF;
          v_output := v_output || '>' || l_vc_return_fields(1) || '</option>';
        END LOOP;
        RETURN v_output || '</select>';
      END get_select_list;You can define three values for p_list_value instead of 2. The third value will be used as option attribute:
    SELECT
    my_package.get_select_list(
    1,
    '20',
    'ACCOUNTING;;10,RESEARCH;;20,SALES;;30;;style="background-color: red;",OPERATIONS;;40'
    ) liste FROM dual;function returns
    <select name="f01" >
    <option value="10">ACCOUNTING</option>
    <option value="20" selected="selected">RESEARCH</option>
    <option value="SALES" style="background-color: red;">SALES</option>
    <option value="40">OPERATIONS</option>
    </select>The next step is just to create a function, which provide the string for p_list_value.

  • Can you have two detail lists from the basic list at the same time?

    Hi
    Can you have two detail lists from the basic list at the same time?
    If yes how and if no why?
    Thanks
    Venkat

    No   ... it is not   possible   of   2 detail  list at   one time   from the basic  list ...
    you can  increament   the SY-LSIND  .... But you can not   display  both the windows   at single time  ...
    it is  possible  to  display  2 Detail list  in ALV   ......  from one  basic  list   using  the  Blocked  list  concept    .
    Sample Program on BLOCK LISTS
    Report   zblock_list
    * Declarations for BLOCK ALV DISPLAY
    *--type pools
    TYPE-POOLS:slis.
    DATA:x_layout TYPE slis_layout_alv,
    t_field TYPE slis_t_fieldcat_alv,
    *--field catalog
    x_fldcat LIKE LINE OF t_field,
    *--to hold all the events
    t_events TYPE slis_t_event,
    x_events TYPE slis_alv_event,
    t_sort TYPE slis_t_sortinfo_alv,
    x_sort LIKE LINE OF t_sort ,
    *--Print Layout
    x_print_layout TYPE slis_print_alv.
    *----Macro to add field catalog.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    DEFINE add_catalog.
    clear x_fldcat.
    x_fldcat-fieldname = &1.
    x_fldcat-seltext_m = &2.
    x_fldcat-outputlen = &3.
    x_fldcat-tech = &4.
    x_fldcat-col_pos = &5.
    x_fldcat-no_zero = 'X'.
    x_fldcat-ddictxt = 'M'.
    x_fldcat-datatype = &6.
    x_fldcat-ddic_outputlen = &7.
    if &6 = 'N'.
    x_fldcat-lzero = 'X'.
    endif.
    *--build field catalog
    append x_fldcat to t_field.
    END-OF-DEFINITION.
    *----- data declerations.
    data: v_repid like sy-repid.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    ernam like mara-ernam,
    meins like mara-meins,
    end of itab.
    data: begin of jtab occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of jtab.
    select matnr ernam meins
    up to 20 rows
    from mara
    into table itab.
    select matnr maktx
    up to 20 rows
    from makt
    into table jtab.
    v_repid = sy-repid.
    *DISPLAY alv
    * Initialize Block
    call function 'REUSE_ALV_BLOCK_LIST_INIT'
    exporting
    i_callback_program = v_repid.
    *Block 1:
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '18' '' '1' 'C' '18',
    'ERNAM' 'Created By' '12' '' '2' 'C' '12',
    'MEINS' 'Unit' '5' '' '3' 'C' '3'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST1'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'ITAB'
    it_events = t_events
    it_sort = t_sort
    tables
    t_outtab = itab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--BLOCK 2(SUMMARY REPORT)
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '20' '' '1' 'C' '18',
    'MAKTX' 'Description' '40' '' '2' 'C' '40'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST2'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    * Append table block.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'JTAB'
    it_events = t_events
    tables
    t_outtab = jtab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--CALL FM TO DISPLAY THE BLOCK REPORT.
    call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    * exporting
    * is_print = x_print_layout
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    form top_of_list1.
    skip 1.
    write: 10 'List 1',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    form top_of_list2.
    skip 1.
    write: 10 'List 2',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    reward  points if it is  usefull ....
    Girish

  • Assigning two dimensional array to each other

    Hi All,
    I have two two-dimensional arrays and I want to assign one's second dimension's values as the other's second dimension's values in this way:
            int userCounter = 0;
            for (int userID : mostCommonUsers) {
                reducedTrainingVectorForSimilarity[userCounter] = trainingVectorForSimilarity[userID];
                userCounter++;
            }In the above code, I have an *"ArrayList<Integer> mostCommonUsers"*, and iterate through this. I'm using the values inside this array list, as a first dimension's index number of the *"trainingVectorForSimilarity"*, and assigning all the values in the second dimension to the left-hand-side array's second dimension. Both array has fixed length of second dimension. So, am I right by doing this, or I should make a for-loop to iterate over the individual values on the second dimensions of both arrays?
    Another similar question: In the below code, *"trainingVectorForSimilarity"* is an *"float[][]"*, so basically I assign all the second dimensions' values into a newly created array named *"trainingUserRatings"*. Again, I assumed that if the corresponding first dimesion's second dimension values will be assign without any iteration over each values.
    for (int i = 0; i < trainingVectorForSimilarity.length; i++) {
                float[] trainingUserRatings = trainingVectorForSimilarity;
    similarity[i] = calculateCosineSimilarity(testingVectorForSimilarity, trainingUserRatings);
    Am I right for both cases?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Here is the output for the code that you sent:
    [[1, 2, 3], [4, 5, 6]]
    [[1, 2, 3], [4, 5, 6]]
    [[1, 2, 3], [4, 5, 6]]
    [[1, 2, 3], [4, 5, 6]]
    [[1, 2, 3], [4, 999999, 6]]
    [[1, 2, 3], [4, 999999, 6]]
    [[1, 2, 3], [4, 999999, 6]]
    [[1, 2, 3], [4, 5, 6]]
    [null, [4, 999999, 6]]
    [null, [4, 999999, 6]]
    [[1, 2, 3], [4, 999999, 6]]
    [[1, 2, 3], [4, 5, 6]]I confused that even making an array copy still refers the same object but not a copy of that object. For example:
    float[][] trainingVectorForSimilarity is defined and initialized.
                float[] trainingUserRatings = new float[trainingVectorForSimilarity.length];
    trainingUserRatings = trainingVectorForSimilarity[i];
    is the same withfloat[] trainingUserRatings = new float[trainingVectorForSimilarity[i].length];
    System.arraycopy(trainingVectorForSimilarity[i], 0, trainingUserRatings, 0, trainingUserRatings.length);

  • Please change the view in the top sites, the 6.1 upgrade has reverted back to a plane two dimensional view, which is a little plain. Can I revert back to an older version via my time capsule save?

    Please change the view in the top sites, the 6.1 upgrade has reverted back to a plain two-dimensional view, which is a little dated. Can I revert back to an older version via my time capsule save? C'mon Apple upgrades supposed to leap into the future not the past. :-(

    Please change the view in the top sites, the 6.1 upgrade has reverted back to a plain two-dimensional view, which is a little dated. Can I revert back to an older version via my time capsule save? C'mon Apple upgrades supposed to leap into the future not the past. :-(

  • How to create a report in excel format having two tab

    Hi All,
    I have Business requirement where customer wants to create a report in excel format having two tab.
    Please let me know if it is possible?
    I am using 10.1.4.3.2 version of BIP.
    Thanks & Regards,
    Edited by: 862749 on May 20, 2013 7:36 PM

    I have Business requirement where customer wants to create a report in excel format having two tab.
    Can anybody suggest if it is possible in BI Publisher or not?yes
    look at excel template
    also you can use xsl-xml or xsl-fo template
    check it for your requirements

  • How to get number of rows and columns in a two dimensional array ?

    Hello,
    What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
    I'm looking for another solution as For...Each loop in case of large arrays.
    Regards,
    Petri

    Hi Petri,
    See a attached txt file for obtaining two arrays with upper and lower index values
    Regards
    Ray
    Regards
    Ray Farmer
    Attachments:
    Get2DArrayIndex.txt ‏2 KB

Maybe you are looking for

  • Problem while adding a new data file

    Hi I add a data file into an existing tablespace. It created data file and did not give any error message. But in the live system, we gets errors: ORA-01157: cannot identify/lock data file 12 - see DBWR trace file ORA-01110: data file 12: 'D:\ORACLE\

  • Airport mirroring not working on i7 Mountain Lion

    Hi all, I've trying to make use of Airport Mirroring on my i7 27" iMac with my Apple TV2. I can play video and audio from iTunes (or from Apple TV) so the devices are clearly connected OK on my wireless network.  But no matter what I do I can't get a

  • Kylix 3

    I have installed kylix 3, but i cant run it. There is error: $ startdelphi /home/networm/kylix3/bin/delphi: relocation error: /home/networm/kylix3/bin/libwine.borland.so: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time re

  • Why can't I save my photo as a JPEG?

    I just finished a project and don't have the option to save it as a Jpeg. Is there a way to fix this? It hasn't happened before.

  • Inability to install Photoshop Elements 8 on Snow Leopard machines

    I don't know whether to blame this on Snow Leopard or not, but I've had nothing but trouble of various kinds since I installed it on two computers, so I'm guessing that may be where the problem lies. I tried to install PSE 8 on each computer and am u