Multi-Dimensional Authorizations

He,
User USR1 should be able to see in a query 2 Characterictics (C1,C2).
Each row of the result set should be in one of the following patterns (or both):
1.  C1=VAL1 (regardless to C2's value)
2.  C2=VAL2 (regardless to C1's value)
USR1 have the following 2 authorizations (BI7 analysis authorizations):
Authorization        C1              C2
auth_1                 VAL1             *
auth_2                    *              VAL2
The current authorization combinations seems to be what I need, however I can't get the right selection set for the query,
since the authorization variables on both Chars get " * ". So the selection set is 'everything' -
> that ends up in "Not Authorized" message.
I have read some notes regardng this problem (557924, 668520.....), but didn't find any solution.
Any thoughts ?
Best Regards,
Dima Dobrovinsky

The values in the infoprovier:
N |C1| C2
1 | A | X
2 | B | Y
3 | C | Z
4 | A | Y
I need to see values: C1=A or C2=Y
It means that the following lines should be returned to a user: 1, 2, 4
1. Assigning one autorization to a user (C1=A and C2=Y)
        this will result only in record 4 (without 1,2)
2. Assignnig 2 authorizations (Auth1:C1=A;   Auth2: C2=Y)
        the user will be authorized as in the previous example - only record 4
        Since in each authorizationmissing one auth. dimension is missing (no C2 in Auth1; no C1 in Auth2),
        After "merging" the authorizations (there is a note on this) - filling the missing dimensions,
        the final authorization will end up like prev. example. (Auth: C1=A and C2=Y)
Thanks, Dima.

Similar Messages

  • How can I (neatly) control mouse click events in a multi-dimensional array?

    Hello everyone!
         I have a question regarding the use of mouse clicks events in a multi-dimensional array (or a "2D" array as we refer to them in Java and C++).
    Background
         I have an array of objects each with a corresponding mouse click event. Each object is stored at a location ranging from [0][0] to [5][8] (hence a 9 x 6 grid) and has the specific column and row number associated with it as well (i.e. tile [2][4] has a row number of 2 and a column number of 4, even though it is on the third row, fifth column). Upon each mouse click, the tile that is selected is stored in a temporary array. The array is cleared if a tile is clicked that does not share a column or row value equal to, minus or plus 1 with the currently targeted tile (i.e. clicking tile [1][1] will clear the array if there aren't any tiles stored that have the row/column number
    [0][0], [0][1], [0][2],
    [1][0], [1][1], [1][2],
    [2][0], [2][1], [2][2]
    or any contiguous column/row with another tile stored in the array, meaning that the newly clicked tile only needs to be sharing a border with one of the tiles in the temp array but not necessarily with the last tile stored).
    Question
         What is a clean, tidy way of programming this in AS3? Here are a couple portions of my code (although the mouse click event isn't finished/working correctly):
      public function tileClick(e:MouseEvent):void
       var tile:Object = e.currentTarget;
       tileSelect.push(uint(tile.currentFrameLabel));
       selectArr.push(tile);
       if (tile.select.visible == false)
        tile.select.visible = true;
       else
        tile.select.visible = false;
       for (var i:uint = 0; i < selectArr.length; i++)
        if ((tile.rowN == selectArr[i].rowN - 1) ||
         (tile.rowN == selectArr[i].rowN) ||
         (tile.rowN == selectArr[i].rowN + 1))
         if ((tile.colN == selectArr[i].colN - 1) ||
         (tile.colN == selectArr[i].colN) ||
         (tile.colN == selectArr[i].colN + 1))
          trace("jackpot!" + i);
        else
         for (var ii:uint = 0; ii < 1; ii++)
          for (var iii:uint = 0; iii < selectArr.length; iii++)
           selectArr[iii].select.visible = false;
          selectArr = [];
          trace("Err!");

    Andrei1,
         So are you saying that if I, rather than assigning a uint to the column and row number for each tile, just assigned a string to each one in the form "#_#" then I could actually just assign the "adjacent" array directly to it instead of using a generic object to hold those values? In this case, my click event would simply check the indexes, one at a time, of all tiles currently stored in my "selectArr" array against the column/row string in the currently selected tile. Am I correct so far? If I am then let's say that "selectArr" is currently holding five tile coordinates (the user has clicked on five adjacent tiles thus far) and a sixth one is being evaluated now:
    Current "selectArr" values:
           1_0
           1_1, 2_1, 3_1
                  2_2
    New tile clicked:
           1_0
           1_1, 2_1, 3_1
                  2_2
                  2_3
    Coordinate search:
           1_-1
    0_0, 1_0, 2_0, 3_0
    0_1, 1_1, 2_1, 3_1, 4_1
           1_2, 2_2, 3_2
                  2_3
         Essentially what is happening here is that the new tile is checking all four coordinates/indexes belonging to each of the five tiles stored in the "selectArr" array as it tries to find a match for one of its own (which it does for the tile at coordinate 2_2). Thus the new tile at coordinate 2_3 would be marked as valid and added to the "selectArr" array as we wait for the next tile to be clicked and validated. Is this correct?

  • Error trying to create a Power View report against a Multi Dimensional SSAS cube

    Hi all,
    We have installed the Power View For Multidimensional Models CTP, released last November 27 on our Analysis Server instances.  I am now trying to create a Power View report in SharePoint that is connected to a Multi-Dimensional cube.
    I have followed the instructions diligently:
    1. Install the CTP
    2. Created a data connection of type "Microsoft BI Semantic Model for Power View" (see attachment #1)
    3. Tested that the connection was valid (all is good here!)
    I then select the "Create Power View Report" option from the data connection that I created above.
    The Power View GUI appears, and then throws an error:
    Error text:
    "An error occurred while loading the model for the item or data source 'http://server/site/SalesVarianceAnalysis_MDX.rsds'. Verify that the connection information is correct and that you have permissions to access the data source."
    The details of the error are:
    <detail><ErrorCode xmlns="rsCannotRetrieveModel</ErrorCode><HttpStatus">http://www.microsoft.com/sql/reportingservices">rsCannotRetrieveModel</ErrorCode><HttpStatus
    xmlns="400</HttpStatus><Message">http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message xmlns="An">http://www.microsoft.com/sql/reportingservices">An
    error occurred while loading the model for the item or data source 'http://hubtest/sites/broadcasting/thewowzone/Data Connections/SalesVarianceAnalysis_MDX.rsds'. Verify that the connection information is correct and that you have permissions to access the
    data source.</Message><HelpLink xmlns="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsCannotRetrieveModel&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=11.0.3000.0</HelpLink><ProductName">http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsCannotRetrieveModel&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.3000.0</HelpLink><ProductName
    xmlns="Microsoft">http://www.microsoft.com/sql/reportingservices">Microsoft SQL Server Reporting Services</ProductName><ProductVersion xmlns="11.0.3000.0</ProductVersion><ProductLocaleId">http://www.microsoft.com/sql/reportingservices">11.0.3000.0</ProductVersion><ProductLocaleId
    xmlns="127</ProductLocaleId><OperatingSystem">http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem xmlns="OsIndependent</OperatingSystem><CountryLocaleId">http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
    xmlns="1033</CountryLocaleId><MoreInformation">http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation xmlns="<Source>ReportingServicesLibrary</Source><Message">http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
    msrs:ErrorCode="rsCannotRetrieveModel" msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsCannotRetrieveModel&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=11.0.3000.0"
    xmlns:msrs="An">http://www.microsoft.com/sql/reportingservices">An error occurred while loading the model for the item or data source '<omitted for security purposes>.
    Verify that the connection information is correct and that you have permissions to access the data source.</Message><MoreInformation><Source></Source><Message>For more information about this error navigate to the report server
    on the local server machine, or enable remote errors</Message></MoreInformation></MoreInformation><Warnings xmlns="http://www.microsoft.com/sql/reportingservices" /></detail>
    So, I can connect with the connection, but I get an error when connecting with Power View. 
    Any suggestions are appreciated.
    Thanks...
    /Peter
    Peter

    Hi Peter - are you specifying the cube name in the connection string?
    Data Source=[server];Initial Catalog=AdventureWorksDW-MD;Cube='Adventure Works'
    Check out
    http://blogs.msdn.com/b/analysisservices/archive/2012/12/09/power-view-for-multidimensional-models-feature-drill-down.aspx

  • Assigning values to 2D Multi-Dimensional arrays ??

    How do I assign a value to a Multi-dimensional 2D Array,
    that has the righter array size omitted as it changes�.
    Code�
    SomeObj foobar = new SomeObj (first, second);
    SomeObj [ ] [ ] d2D = new SomeObj [10] [ ];
    d2D [0][0] = foobar;     //Causes a null pointer exception�
    NB: seems if I initiate �d2D = new SomeObj [10] [10];� with the righter array size initiated then the error doesn�t occur, but because of the nature of the data the size of each secondary array varies�
    Thx. Kharsim

    apparently not...
    from what i read up on Multi-Dimensional arrays, you only have to give a value to the leftest bracket...
    e.g.
    int [ 5 ] [     ] [     ] <~ Acceptable in Java
    int [ 5 ] [  6 ] [     ] <~ Acceptable in Java
    int [ 5 ] [  6 ] [ 24 ] <~ Acceptable in Java
    int [ 5 ] [     ] [ 24 ] <~ Not acceptable in Java
    so using arrays it should be possible to assign a value in either of the acceptable cases, but couldnt find a source that had such an example...

  • Populating ADF Table from Multi-Dimensional Array

    Hello!
    I'm trying to populate an ADF table from a multi-dimensional array.
    Let's say that my array is
    String [] [] myArr = new String [3][5].
    On my page backing bean, I have a private attribute called tmpArr like this...
    String [] [] tmpArr;
    ...which I will initialize later after I know the proper dimensions. The dimensions will come from a multimap that contains a key and and another array (for the key's value) containing values for the key. So once I know the dimensions I initialize my array with...
    tmpArr = new String [x][y] where x and y are the dimensions (counters).
    Now I have my multidimension array. On an jsp page I have an ADF table, and I'm setting the value for the table to the array (the table's value property is bound to the backing bean's tmpArr attribure).
    Like so:
    <af:panelForm id="availableOptions"
    binding="#{myBackingBean.availableOptionsValues}">
    <af:table emptyText="No items were found" rows="10"
    value="#{myBackingBean.tmpArr}" var='myArr'>
    Now I need to know how to do the following:
    1) Set the table's columns based on the number of attributes on the array.
    2) Set the table's rows based on the array's length.
    3) Set each table cell value to values on the array's 2nd dimension. I'm assuming that ADF takes care iterating through the array, and that I should do something like...
    <af:outputText value="#{myArr[][0]}"/>
    <af:outputText value="#{myArr[][1]}"/>
    etc...
    However, this isn't working...
    javax.faces.el.ReferenceSyntaxException: myArr[][0]
    ...bla bla bla...
    Was expecting one of:
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    "null" ...
    "not" ...
    "empty" ...
    <IDENTIFIER> ...
    Is there a blog or resource (article, book, etc) that shows how this is done? Anyone has done this and would like to share how?
    Thank you.

    This is in fact possible. I'm not sure about the "best practice" around doing this but there is a couple of ways to do this.
    You can either create a managed bean then right click on it and use the wizard to create a data control or you can do it as per below
    The a table will convert an array into a collection.
    Once you have created an array and generated the accessors in a bean you can then reference the mutli-dimensional array from a table as per below.
    <af:table value="#{pageFlowScope.PageBean.sessionArr}" var="row" rowBandingInterval="0" id="t1" varStatus="status">
    <af:column sortable="false" headerText="col1" id="c1">
    <af:outputText value="#{pageFlowScope.PageBean.sessionArr[status.index][0]}" id="ot1"/>
    </af:column>
    </af:table>
    String [][] sessionArr = new String[5][2];
    public void setSessionArr(String[][] sessionArr) {
    this.sessionArr = sessionArr;
    public String[][] getSessionArr() {
    sessionArr[0][0]="rice";
    sessionArr[1][0]="water";
    return sessionArr;
    EDIT: For either of the above methods the managed bean must have a scope of pageFlow or longer.
    Cheers,
    Aaron
    Edited by: Aaron Rapp on Oct 6, 2011 3:28 PM

  • Best practice in JSTL with multi-dimensional arrays

    Hi,
    I'm working in a project and I'm trying to convert some code into JSTL way, I have a first.jsp that calls addField(String, String) from fieldControl.jsp:
    (first.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ include file="fieldControl.jsp" %>
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <%! String[][] list1;
    %>
    <%
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_2";
    list1[1][0]="second_1";
    list1[1][1]="second_2";
    for (int i=0;i<list1.length;i++){
    String html;
    html = addField (list1[0], list1[i][1]);
    out.println(html);
    %>
    </body>
    </html>
    (fieldControl.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="java" %>
    <%! public void addField(String name,String label)
    return ...
    Now for JSTL I've this example from "JSTL pratical guide for JSP programmers" Sue Spielman:
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <html>
    <head>
    <title>
    Display Results
    </title>
    </head>
    <body>
    <%-- Create a HashMap so we can add some values to it --%>
    <jsp:useBean id="hash" class="java.util.HashMap" />
    <%-- Add some values, so that we can loop over them --%>
    <%
         hash.put("apples","pie");
         hash.put("oranges","juice");
         hash.put("plums","pudding");
         hash.put("peaches","jam");
    %>
    <br>
    <c:forEach var="item" items="${hash}">
    I like to use <c:out value="${item.key}" /> to make <c:out value="${hash[item.key]}" />
    <br>
    <br>
    </c:forEach>
    </body>
    </html>
    and my problem is :
    1st - how to use the multi-dimensional array in this way (<jsp:useBean id="hash" class="java.util.HashMap" />) ? because if I use it like this
    <% String[][] list1;
    list1 = new String[2][2];
    list1[0][0]="first_1";
    list1[0][1]="first_1";
    list1[1][0]="second_1";
    list1[1][1]="second_2";%>
    <c:out value="${list1}" />
    <c:out value="${list1.lenght}" />
    I get nothing,
    also tryed <c:set var="test" value="<%=list1.length%>" /> and got "According to TLD or attribute directive in tag file, attribute value does not accept any expressions"
    2nd hot to make the call to the method addField?
    Thanks for any help, I really want to make this project using JSTL, PV

    When you are using JSTL, it is best to not put data inside the JSP. Put it inside JavaBeans. Then make calles to the methods in those JavaBeans.
    So you should get used to JavaBeans and their requirenments.
    Access JavaBeans only through 2 types of methods: getters and setters.
    Getters are used to "get" values (properties) from the bean, and always have the form
    public Type getPropertyName(void)
    That is, they are public, return some value, start with the exact string "get" end with the name of the property (first letter of the property name capitalized) and have a void (empty) argument list.
    For example, this is a good signature to get HTML from a bean:
    public String getHtml()
    Setters are used to assign values to a bean. They always have the form
    public void setPropertyName(Type value)
    That is, they are public, do not return anything, start with the string "set", end with the name of the property (first letter capitalized), and take a SINGLE parameter.
    public void setHtml(String value)
    Also, JavaBeans must have a no argument constructor and need to be Serializable.
    The way I would approach this would be to create a JavaBean that holds the two dim array for you, and has a getter that returns a list of all the formatted html.
    package mypack;
    import java.util.List;
    import java.util.ArrayList;
    public class DataFormatterBean implement java.io.Serializable {
      private String[][] list;
      public DataFormatterBean() {
        list = new String[2][2];
        list[0][0]="first_1";
        list[0][1]="first_2";
        list[1][0]="second_1";
        list[1][1]="second_2";
      public List getHtml() {
        List outputHtml = new ArrayList(list.length);
        for (int i = 0; i < list.length; i++) {
          String html = addField(list[0], list[i][1]);
    outputHtml.add(html);
    return outputHtml;
    private addField(String a, String b) { .. do work .. }
    Then, the JSP would look like this:
    <jsp:useBean id="dataFormatter" class="mypack.DataFormatterBean"/>
    <c:forEach var="htmlString" items="${dataFormatter.html}">
      <c:out value="${htmlString}"/>
    </c:forEach>Once you start thinking in terms of having JavaBeans do your work for you JSTL is so much easier... and it gets even easier when you start to delve into custom tags.

  • Use of multi-dimensional arrays in forms - forms debugger crash

    Hello All readers,
    have an issue with use of multi-dimensional arrays in forms when debugging and/or calling another form post array-population.
    USING VERSIONS: oracle forms 9.0.4, Jinitiator 1.3.1.17, oracle db 10.1
    the following code snippet works from a when-button-pressed trigger when called without the debugger. when called with the debugger it crashes when any element of the multi-dimensional associative array is accessed/populated/read. In addition, if i populate the multi-dimensional array then call a form (a msgbox form to display the arrays content as a string) it crashes too.
    declare
    type datasource_rec is record (field varchar2(32), val varchar2(3999));
    type datasource_arr is table of datasource_rec index by binary_integer;
    type datasource_arr_arr is table of datasource_arr index by binary_integer;
         l_arr datasource_arr_arr;
         procedure poparr(i_arr out datasource_arr_arr) is
              idx binary_integer := 1;
              iidx binary_integer := 1;
         begin
              while (idx <= 10) loop
                   iidx := 1;
                   while (iidx <= 10) loop     
                        i_arr(idx)(iidx).field := 'field'||to_char(iidx)||':'||to_char(idx); --# debugger crashes here with JVM aborting... message (which crashes forms builder too)
    i_arr(idx)(iidx).val := 'test value';
                   iidx := iidx+1;     
                   end loop;
              idx := idx+1;
              end loop;
         end;
         procedure printarr is
              idx binary_integer := l_arr.first;
              iidx binary_integer;
              l_msg varchar2(4000);
              l_response pls_integer;
         begin
              while (idx is NOT null) loop
                   iidx := l_arr(idx).first;
                   while (iidx is NOT null) loop
                        l_msg := l_msg||chr(10)||l_arr(iidx)(idx).field||' = '||l_arr(iidx)(idx).val;
                   iidx := l_arr(idx).next(iidx);
                   end loop;
              idx := l_arr.next(idx);
              end loop;
              alerts.info('see console for full printout: '||chr(10)||l_msg);
    --l_response := msgbox.show(l_msg); --calls another modal form to display a long message, which crashes the runtime with a java console message*
         r$debug.print(l_msg);
         end;
    begin
         poparr(l_arr);
         printarr;
    end;
    The java console does not print anything useful when both forms builder and the runtime crash/hangs as a result of the debugger being attached (except displaying a "JVM aborting" message) but when the runtime alone crashes as a result of calling another form after popping the MD array it prints:
    oracle.forms.net.ConnectionException: Forms session <28> aborted: unable to communicate with runtime process.
         at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
         at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
         at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
         at oracle.forms.net.HTTPNStream.flush(Unknown Source)
         at java.io.DataOutputStream.flush(Unknown Source)
         at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    has anyone else encountered this problem and found a solution/workaround? is their some sort of memory limitation for forms-side handling of (multi-dimensional) arrays?+
    many thanks
    ps: i get similar problems when a) populating the array from a server/db-side packaged procedure (crashes with java console message as above even when not debugging) b) using server/db-side packaged types for the array.

    Hello All readers,
    have an issue with use of multi-dimensional arrays in forms when debugging and/or calling another form post array-population.
    USING VERSIONS: oracle forms 9.0.4, Jinitiator 1.3.1.17, oracle db 10.1
    the following code snippet works from a when-button-pressed trigger when called without the debugger. when called with the debugger it crashes when any element of the multi-dimensional associative array is accessed/populated/read. In addition, if i populate the multi-dimensional array then call a form (a msgbox form to display the arrays content as a string) it crashes too.
    declare
    type datasource_rec is record (field varchar2(32), val varchar2(3999));
    type datasource_arr is table of datasource_rec index by binary_integer;
    type datasource_arr_arr is table of datasource_arr index by binary_integer;
         l_arr datasource_arr_arr;
         procedure poparr(i_arr out datasource_arr_arr) is
              idx binary_integer := 1;
              iidx binary_integer := 1;
         begin
              while (idx <= 10) loop
                   iidx := 1;
                   while (iidx <= 10) loop     
                        i_arr(idx)(iidx).field := 'field'||to_char(iidx)||':'||to_char(idx); --# debugger crashes here with JVM aborting... message (which crashes forms builder too)
    i_arr(idx)(iidx).val := 'test value';
                   iidx := iidx+1;     
                   end loop;
              idx := idx+1;
              end loop;
         end;
         procedure printarr is
              idx binary_integer := l_arr.first;
              iidx binary_integer;
              l_msg varchar2(4000);
              l_response pls_integer;
         begin
              while (idx is NOT null) loop
                   iidx := l_arr(idx).first;
                   while (iidx is NOT null) loop
                        l_msg := l_msg||chr(10)||l_arr(iidx)(idx).field||' = '||l_arr(iidx)(idx).val;
                   iidx := l_arr(idx).next(iidx);
                   end loop;
              idx := l_arr.next(idx);
              end loop;
              alerts.info('see console for full printout: '||chr(10)||l_msg);
    --l_response := msgbox.show(l_msg); --calls another modal form to display a long message, which crashes the runtime with a java console message*
         r$debug.print(l_msg);
         end;
    begin
         poparr(l_arr);
         printarr;
    end;
    The java console does not print anything useful when both forms builder and the runtime crash/hangs as a result of the debugger being attached (except displaying a "JVM aborting" message) but when the runtime alone crashes as a result of calling another form after popping the MD array it prints:
    oracle.forms.net.ConnectionException: Forms session <28> aborted: unable to communicate with runtime process.
         at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
         at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
         at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
         at oracle.forms.net.HTTPNStream.flush(Unknown Source)
         at java.io.DataOutputStream.flush(Unknown Source)
         at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    has anyone else encountered this problem and found a solution/workaround? is their some sort of memory limitation for forms-side handling of (multi-dimensional) arrays?+
    many thanks
    ps: i get similar problems when a) populating the array from a server/db-side packaged procedure (crashes with java console message as above even when not debugging) b) using server/db-side packaged types for the array.

  • Setting up a multi dimensional array of objects

    Hey ya'll. How would i setup a multi dimensional array with this structure?
    TypeSave(Title, material(name, quantity))
    TypeSave[1](Lego Shop, material[1](Lego Blocks, 100))
                   material[2](Roof, 1))
    TypeSave[2](Lego Car, material[1](Door, 2))
              material[2](Gravy, 3, ounces))
    TypeSave will be saved as a serialised object to a file so i can load everything within it and keep the structures integrity.
    I'll have an add button that will add the name and quantity to the next empty position of "material" array. This will then be listed in a list box and allow me to save all the materials with a title to the TypeSave list in the next empty position.
    I'm getting mightily confused how to set up the classes and the array structure :(
    Any help would be greatly appreciated!

    private TypeSave t = new TypeSave();
    private void btnSaveItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
            t.addItem(txtItemTitle.getText(), new Material(txtMaterialName.getText(),txtQuantity.getText()));
            t.saveToFile();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MainForm().setVisible(true);
        class Material implements Serializable {
         String name = null;
         String quantity = null;
         //To restrict default constructor
         private Material() {
         public Material(String name, String quantity) {
              this.name = name;
              this.quantity = quantity;
         public String getName() {
              return this.name;
         public String getQuantity() {
              return this.quantity;
         public String toString() {
              return "Name : " + this.name + "Quantity : " + this.quantity;
    class TypeSave implements Serializable {
         private Hashtable items = null;
         public TypeSave() {
              items = new Hashtable();
         public void addItem(String title,Material material) {
              ArrayList materials = (ArrayList) items.get(title);
              if(materials == null) {
                   materials = new ArrayList();
                   items.put(title,materials);
              materials.add(material);
         public Hashtable getItems() {
              return this.items;
         public ArrayList getItem(String title) {
              return (ArrayList)this.items.get(title);
            void saveToFile() {
        ObjectOutputStream oos = null;
            try
            oos = new ObjectOutputStream(new FileOutputStream("item.ser"));
            catch (IOException i)
              System.out.println( "Error opening file");
          try
            oos.writeObject(items);
            catch (IOException o)
                System.out.println("Error writing file");
          try
              if(oos != null)
              oos.close();
            catch (IOException x)
                System.out.println("Error closing file");
    }My save class was working, but i tried to merge it to test this code structure and now it's failing with excepion:
    "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
    any ideas?

  • Multi-Dimensional Sets in a hierarchy

    Hi
    I'm trying to create a set hierarchy which contains multi-dimensional sets.  When adding the multi-dimensional set as a sub-ordinate in the hierarchy I receive the error <Set Name> invalid characteristic  for Input Field HKONT.
    The requirement is that on a report in BI we need to limit rows on a report to specific GL accounts and then specific transaction types (BEWAR) within those GL accounts.  We have around 20 reports that have the same format but the GL accounts and Transaction Types on each row are different - hence we wanted to use sets to maintain the GL accounts and transaction types for each row.
    So I've created several sets which are single sets and it all works fine.  But when I create a multidimensional set (with Account and Transaction Type) it works fine.  But when I attempt to add that as a subordinate set (ie to create the row in the report hierarchy) I get this message. 
    The Set that contains the rows can't be a multidimensional set as I can't add multi-dimensional sets to multi-dimensional sets.  
    Anyone come across this or know of a way around it ?  or perhaps a different approach.
    Thanks

    Hi
    I guess the problem is because, in a multi dimensional set, you have more than one char i.e. HKONT and BEWAR... In your report row, have you included both of these chars or just one?
    Try to include both the chars and then use a multi dimensional set in the row...
    The idea of multi dimensional set is that no char in it should repeat... When you are adding this multi set to a BASIC SET or SINGLE SET, you are bound to get this error in GS01
    Br, Ajay M

  • Binding arraylist, list, or multi-dimensional array to table in web dynpro

    Greetings,
    I like to ask if anyone knows how to bind data from an arraylist, list, or multi-dimensional array list to a table in web dynpro, your help is much appreciated.
    Thanks in advance.
    Cory

    Is there a way to create or cast a multi-dimensional
    array from a Collection or Vector ?
    ArrayList list = new ArrayList();
    list.add( new Object[4] );
    Object[] array2 = list.toArray(); // is only
    single dimension !
    Of course it is a single dimension array.
    Check the definition of the toArray() function, and the specification of arrays in general.
    toArray() returns a one dimensional array.
    In your case it will return an array of arrays. So array2[0] will be an array of 4 objects.
    That just happens to be a 2 dimensional array though you may (I haven't checked it) need some parentheses to call the elements.
    Try Object o = array2[0][1]; and if that doesn't work Object o = (array2[0])[1];

  • Multi-dimensional arrays with non-specified dimension

    Hi all,
    I'm trying to write a method to create a multi-dimensional array of
    Integer, based on another one, taken as parameter. I would like the
    method to work for an array of a non-specified dimension, that is,
    it could take as parameter a Integer[], or a Integer[][], or a
    Integer[][][] and so on.
    The idea is to have as a result an array with the original elements
    doubled.
    Here is my recursive function:
        public static Object[] f(Object[] a) {
             // the array to be returned is created with the
             // same size as the original
            Object[] r = new Object[a.length];
            for (int i=0; i<a.length; i++) {
                Object elem = a;
    Object newElem = null;
    if (elem instanceof Object[]) {
    // Recursive case
    newElem = f((Object[]) elem);
    } else if (elem instanceof Integer) {
    // Base case
    newElem = new Integer(((Integer)elem).intValue() * 2);
    r[i] = newElem;
    return r;
    This method returns an array with the same structure (that is, same
    dimensions) of the array taken in the constructor. In the recursive
    case, it just calls the function to the inner arrays. In the base
    case, where I have an Integer, it creates a new Integer, whose
    value is the old multiplied by 2.
    Then I initialize an array:
        public static void main(String args[]) throws Exception {
            Integer[][] a = new Integer[][] {
                new Integer[] {
                    new Integer(0), new Integer(2)
                new Integer[] {
                    new Integer(1), new Integer(4), new Integer(3)
      // And try to call the function like this:
            Integer [][] b = (Integer [][]) f(a);
        }   And I get a java.lang.ClassCastException: [Ljava.lang.Object;
    I don't understand the reason of this exception, because the
    object returned is a Integer[][]. Isn't it?
    And since I don't have a compiler error in the cast, that means
    that Object[] and Integer[][] are not inconvertible. Right?
    Could anyone explain me why this is wrong and/or give me some
    ideas to do what I'm trying to do?
    Thanks a lot,
    Angela

    I retract my previous statement about using
    reflection. Use "Object[] r =(Object[])a.clone()"
    to create a new array of the same type.You don't need temporary array variable here.
    You could simply use argument a instead of r.
    (But this my gotcha is derived from your clever rep.)Well, this isn't a temporary variable, its the return variable, which is different. If you don't want the original matrix changed, you have to clone the argument.

  • Read file into multi-dimensional array - ideal world...

    Hello all, would be very grateful if you could help me...
    I have a file which has a format...
    string1a,string1b
    string2a,string2bi need to read this file, which will have a variable length, into a two dimensional array.
    the code below is just demonstrating my approach...
              List lines = new ArrayList();
              BufferedReader in = new BufferedReader(new FileReader(filename));
              String str;
              while ((str = in.readLine()) != null) {
                   lines.add(str.split(","));
              in.close();but when i later try and invoke the toArray() method of lines it complains about unsafe or unchecked operations.
    does any have any pointers about the best way to read a file into a multi-dimensional array? is it best practice to use the interface List?
    thanks in advance
    poncenby

    This is just a List of Lists - no worries there.
    Sounds like your toArray code is incorrect. Post that.
    %

  • JNI: Multi-dimensional (3-D) Array [][][]

    Hi,
    Am having trouble with passing multi-dimensional arrays from C++ to Java.
    The Java method receives an object but it's contents are null.
    The received (in Java) object's length is correct.
    If I only have a 2d array, I do not encounter a problem.
    // Create the class
    jclass intClass = env->FindClass("[I");
    // Create 1st and 2nd array
    jobjectArray array1 = env-> NewObjectArray(30, intClass, NULL)
    jobjectArray array2 = env-> NewObjectArray(2, intClass, NULL)
    // Create 3rd Array
    jintArray array3 = env->NewIntArray(100);
    // Put some data into array3
    env-> SetIntArrayRegion(array3 , 0, 1, myBuffer);
    // Add array 3 to array 2 and array 2 to array 1
    env->SetObjectArrayElement(array2 , 0, array3);
    env->SetObjectArrayElement(array1 , 0, array2 );
    // Call the Java method
    env->CallVoidMethod(obj, mid, array1 )I have checked before calling the Java method that all 3 arrays are created and have the correct sizes.
    The example in Sheng Liang's book is only for 2d Arrays.
    Any ideas ?
    Many thanks.
    Andy

    Hi,
    I'm not very aware of arrays under JNI but I thought the number of [ were the number of dimension :
    // Create the class
    jclass intClass = env->FindClass("[[[I");--Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Multi-dimensional Array Question

    Hi all,
    I am trying to build a Multi-dimensional Object Array from several One Dimensional Object Arrays. I am looping through a .properties file to determine how many individual Object Arrays will be added to the Multi-dimensional Array. The part that I am having trouble with is in adding each Array to the Multi-dimensional Array in the loop.
    For example:
      public Object[] getRowData(String row_str)
        StringTokenizer st = new StringTokenizer(row_str,"|");
        Object[] row_data = new Object[st.countTokens()];
        for(int i = st.countTokens();i > 0;--i)
          Arrays.fill(row_data,st.nextToken());
        return row_data;
      public Object[][] getTableData()
        int rows = new Integer(resources.getString("Rows")).intValue();
        Object[][] data = null;
        for(int j = 0;j < rows;j++)
          String row_str = resources.getString("row_"+j);
          Object[] row_data = getRowData(row_str);
    // Here is the prolbem.  I need to add each individual row_data Array to the Multi-dimensional Array(data) .
    //      data = row_data;  This does not work.
        return data;
      }Thanks in Advance.

    Set the 2darray size ...then do some casting ...don't forget the index [j]:
        Object[][] data = new Object[rows][0];
        for(int j = 0;j < rows;j++)    {
          data[j] = (Object[]) row_data;
        }

  • Cloning multi-dimensional arrays

    I am working on this program of mine and really need some help since I am completely stuck, the thing is that I am trying to clone a multi-dimensional array, I have tried with a simple array and that worked fine, but not with the multi-dimensional. Like this:
    int[] initialSquareValues3 = {1,2,3};
    int[] squareValues3 = initialSquareValues3.clone();
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    squareValues3[0] = 3;
    System.out.println(initialSquareValues3[0]);
    System.out.println(squareValues3[0]);
    Will give the output "1 1 1 3", just what i want. While this:
    int[][] initialSquareValues2 = {{1,2,3}, {4,5,6}, {7,8,9}};
    int[][] squareValues2 = initialSquareValues2.clone();
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    squareValues2[0][0] = 3;
    System.out.println(initialSquareValues2[0][0]);
    System.out.println(squareValues2[0][0]);
    Will give the output "1 1 3 3" where "squareValues2" only seems to be a reference to the same data as the original "initialSquareValues2"
    So the question is simply: How do i clone a multi-dimensional array?
    I'm running Java SE 5.0 (1.5.0) and the code is run inside the contructor in a class extending JPanel.

    No need to explicitly do any copying of elements except as part of deepening the clone.
        public int[][] cloneIntArrays(int[][] array)
            // Create shallow clone
            int[][] clonedArray = array.clone();
            // Deepen the shallow clone
            for (int index = 0; index < clonedArray.length; index++)
                clonedArray[index] = clonedArray[index].clone();
            return clonedArray;
        }

Maybe you are looking for