Creating an ArrayList as an attribute

Hello all,
I'm new to Java and hope to learn a lot about the language. I've lost much sleep over this last program I was assigned to complete. I've tried everything to try and get this program working properly. As a school assignment we are required to create 3 classes: a loan class, a payment class and a class which handles database and query execution. All we have to do is print the loan information along with the payment information. A loan has multiple payments along with other attributes. I've written all of the code and am struggling on one area, the ArrayList portion of the program. We are supposed to have an ArrayList which contains information about loan payments (retrieved from the database). How do I create an instance of ArrayList <Payments> inside of my loan constructor? I keep getting a null pointer exception when running the program. Maybe my code makes more sense. Thanks in advance for any assistance.
import java.util.ArrayList;
public class Loan {
     private String loanID; //id no
     private String startDate; //date
     private double annualRate; //loan annual rate
     private double loanAmt; //loan amount due
     private int noYears; //years on loan
     private ArrayList<Payment> payments;
     /*public Loan (String l, String s, double ar, double la, int ny, ArrayList<Payment> p)
     { loanID = l;
          startDate = s;
          annualRate = ar;
          loanAmt = la;
          noYears = ny;
          ArrayList<Payment> payments = new ArrayList<Payment>();
     public Loan ()
          { this.loanID= loanID;
               this.startDate = startDate;
               this.annualRate= annualRate;
               this.loanAmt = loanAmt;
               this.noYears = noYears;
               this.payments = payments;
     }//end loan constructor
     public void setloanID (String l)
     loanID = l;
     }//end setloanID
     public String getloanID ()
          return loanID;
     }//end getloanID
     public void setstartDate (String s)
     startDate = s;
     }//end setstartDate
     public String getstartDate ()
          return startDate;
     }//end getstartDate
     public void setannualRate (double ar)
          annualRate = ar;
     public double getannualRate (double ar)
          return annualRate;
     }//end getstartDate
     public void setloanAmt (double la)
     loanAmt = la;
     public double getloanAmt (double la)
          return loanAmt;
     }//end getstartDate
     public void setnoYears (int ny)
          noYears = ny;
     public int getnoYears (int ny)
          return noYears;
     }//end getstartDate
     public ArrayList <Payment> getPayments ()
          return payments;
     }//end getPayments
}//end loan
import java.util.ArrayList;
public class Payment {
private String loanID;
private String datePaid;
private double amount;
private double principlePaid;
public Payment ()
     this.loanID = loanID;
     this.datePaid= datePaid;
     this.amount = amount;
     this.principlePaid = principlePaid;
}//end loan constructor
void setAmount (double amount){
     this.amount = amount;
public double getAmount()
     return amount;
void setdatePaid (String datePaid) {
     this.datePaid = datePaid;
public String getdatePaid (){
     return datePaid;
void setloanID (String loanID)
     this.loanID = loanID;
public String getloandID ()
     return loanID;
void setprinciplePaid (double principlePaid)
     this.principlePaid = principlePaid;
public double getprinciplePaid ()
     return principlePaid;
}//end payment class
import java.sql.*;
import java.util.ArrayList;
public class Hw6Dbase {
     //Driver NAme and Database URL
     static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
     static final String dbaseURL = "jdbc:odbc:homework5";
     //ArrayList<Payment> payments = new ArrayList<Payment>();
     public static void main (String args[])
          Loan loan = new Loan ("", "", 0, 0, 0, null); //ArrayList<Payment> p);
          Connection connection = null; //connection
     Statement statement = null; //queries
     try
     { Class.forName(driver);
     connection = DriverManager.getConnection(dbaseURL, " ", " ");
     statement = connection.createStatement();
     //query
     {ResultSet resultSet = statement.executeQuery("select * from loan where loanID= '0001'");
     //process the results
     //ResultSetMetaData dbMetaData = resultSet.getMetaData();
     //ResultSetMetaData dbMetaData2 = resultSet2.getMetaData();
     System.out.println("Loan Information");
          while (resultSet.next())
               loan.setloanID(resultSet.getString(1));
               loan.setstartDate(resultSet.getString(2));
               loan.setnoYears(resultSet.getInt(3));
               loan.setannualRate(Double.parseDouble(resultSet.getString(4)));
               loan.setloanAmt(Double.parseDouble(resultSet.getString(5)));
               String loanid = loan.getloanID();
               System.out.println ("Loan id:" + loanid);
          String loanDate = loan.getstartDate();
          double loanAmt = loan.getloanAmt(0.0);
          double rate = loan.getannualRate(0.0);
          int years = loan.getnoYears(0);
          //ArrayList <Payment> p = loan.getPayments();
          System.out.println("Start Date:" + loanDate);
          System.out.printf("Amount:%.2f\n", loanAmt);
          System.out.println("Annual Rate: "+ rate);
          System.out.println("Loan Duration:" + years);
          //System.out.println("TEST:" + p); //null
          }//end while
          System.out.println("\nPayments Received");
     ResultSet resultSet2 = statement.executeQuery("select * from payments where loan_ID='0001'");
          while (resultSet2.next())
               Payment payment = new Payment();
                    payment.setAmount(Double.parseDouble(resultSet2.getString(4)));
                    payment.setdatePaid(resultSet2.getString(3));
                    payment.setloanID(resultSet2.getString(2));
                    payment.setprinciplePaid(Double.parseDouble(resultSet2.getString(5)));
          //double amount = payment.getAmount();
                    //Test data
                    //String loanID = payment.getloandID();
                    //System.out.println("TEST:" + loanID);
                    //double pamount =payment.getAmount();
                    loan.getPayments().add(payment);
          //loan.payments.add(payment);
                    int n = loan.getPayments().size();
                    for (int i= 1; i<= n; i++)
                    //System.out.println(i);
                         System.out.println (loan.getPayments().get(i).getAmount());
                         System.out.println (loan.getPayments().get(i).getdatePaid());
                         System.out.println (loan.getPayments().get(i).getloandID());
                         System.out.println (loan.getPayments().get(i).getprinciplePaid());
                    //System.out.println (n);
     }//end try
     catch (IndexOutOfBoundsException indexObException)
     {indexObException.printStackTrace();
     }//end catch
     catch (SQLException sqlException)
     {sqlException.printStackTrace();
     System.out.println("Cannot get connection");
     System.exit(1);
     }//end catch
     catch (ClassNotFoundException classNotFound)
          classNotFound.printStackTrace();
          System.out.println("Class not found");
          System.exit(1);
     finally
          try {
               statement.close();
               connection.close();
          }//end try
     catch (Exception exception)
     exception.printStackTrace();
     System.exit(1);
     }//end catch
     }//end finally
     }//end main
}//end Hw6Dbase

when I query the database using my other program (just doing this to show you whats in the payment table) "select * from payments" I get this.
Admin_ID     Loan_ID     Payment_Date     Payment_Amount     Payment_To_Principle     
0001      0001     2000-05-10 00:00:00     1000.0000     600.0000     
0001     0001     2000-06-10 00:00:00     1000.0000     610.0000     
0001     0002     2000-06-15 00:00:00     1500.0000     1000.0000     
0100     0001     2000-07-10 00:00:00     1000.0000      620.0000     
in this program we only want the payments for loan id '0001'. So in my code you can see that I query as follows:
ResultSet resultSet2 = statement.executeQuery("select * from payments where loan_ID='0001'");
Heres what I get in console when I test "n". (System.out.println(n);)
Payments Received
0
1
1
2
2
2
This is what prints out when I run the program...
Loan Information
Loan id:0001
Start Date:2000-05-05 00:00:00
Amount:10000.00
Annual Rate: 0.06
Loan Duration:5
Payments Received
Loan ID: 0001 //(n=0)
Loan Amount: 1000.0
Date Paid: 2000-05-10 00:00:00
Payment to Principle: 600.0
Balance:9400.0
Loan ID: 0001 //DUPLICATE
Loan Amount: 1000.0
Date Paid: 2000-05-10 00:00:00
Payment to Principle: 600.0
Balance:9400.0
Loan ID: 0001 //DUPLICATE
Loan Amount: 1000.0
Date Paid: 2000-06-10 00:00:00
Payment to Principle: 610.0
Balance:9390.0
Loan ID: 0001
Loan Amount: 1000.0
Date Paid: 2000-05-10 00:00:00
Payment to Principle: 600.0
Balance:9400.0
Loan ID: 0001
Loan Amount: 1000.0
Date Paid: 2000-06-10 00:00:00
Payment to Principle: 610.0
Balance:9390.0
Loan ID: 0001
Loan Amount: 1000.0
Date Paid: 2000-07-10 00:00:00
Payment to Principle: 620.0
Balance:9380.0
Strange order huh? I can't figure it out any ideas?.... here's my code again.
import java.sql.*;
import java.util.ArrayList;
public class Hw6Dbase {
     //Driver NAme and Database URL
     static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
     static final String dbaseURL = "jdbc:odbc:homework5";
     public static void main (String args[])
          Loan loan = new Loan();
          Connection connection = null; //connection
          Statement statement = null; //queries
     try
     { Class.forName(driver);
     connection = DriverManager.getConnection(dbaseURL, " ", " ");
     statement = connection.createStatement();
     //query
     {ResultSet resultSet = statement.executeQuery("select * from loan where loanID= '0001'");
     System.out.println("Loan Information");
          while (resultSet.next())
               loan.setloanID(resultSet.getString(1));
               loan.setstartDate(resultSet.getString(2));
               loan.setnoYears(resultSet.getInt(3));
               loan.setannualRate(Double.parseDouble(resultSet.getString(4)));
               loan.setloanAmt(Double.parseDouble(resultSet.getString(5)));
               String loanid = loan.getloanID();
               System.out.println ("Loan id:" + loanid);
          String loanDate = loan.getstartDate();
          double loanAmt = loan.getloanAmt();
          double rate = loan.getannualRate();
          int years = loan.getnoYears();
          System.out.println("Start Date:" + loanDate);
          System.out.printf("Amount:%.2f\n", loanAmt);
          System.out.println("Annual Rate: "+ rate);
          System.out.println("Loan Duration:" + years);
          }//end while
          System.out.println("\nPayments Received");
     ResultSet resultSet2 = statement.executeQuery("select * from payments where loan_ID='0001'");
          while (resultSet2.next())
               Payment payment = new Payment();
                    //set payment attributes
                    payment.setloanID(resultSet2.getString(2));
                    payment.setAmount(Double.parseDouble(resultSet2.getString(4)));
                    payment.setdatePaid(resultSet2.getString(3));
                    payment.setprinciplePaid(Double.parseDouble(resultSet2.getString(5)));
                    int n = loan.getPayments().size();
                    loan.getPayments().add(payment);
                    for (int i= 0; i<= n; i++)
                         double balance = loan.getloanAmt()-loan.getPayments().get(i).getprinciplePaid();
                         //output
                         //System.out.println(n);//test count
                         System.out.println ("Loan ID: " +loan.getPayments().get(i).getloandID());
                         System.out.println ("Loan Amount: " +loan.getPayments().get(i).getAmount());
                         System.out.println ("Date Paid: " +loan.getPayments().get(i).getdatePaid());
                         System.out.println ("Payment to Principle: "+loan.getPayments().get(i).getprinciplePaid());
                         System.out.println ("Balance:" +balance);
                         System.out.println ("\n");
                    }//end for
          }//end of while
     }//end try
     //catch (IndexOutOfBoundsException indexObException)
     //{indexObException.printStackTrace();
     }//end catch
     catch (SQLException sqlException)
     {sqlException.printStackTrace();
     System.out.println("Cannot get connection");
     System.exit(1);
     }//end catch
     catch (ClassNotFoundException classNotFound)
          classNotFound.printStackTrace();
          System.out.println("Class not found");
          System.exit(1);
     finally
          try {
               statement.close();
               connection.close();
          }//end try
     catch (Exception exception)
     exception.printStackTrace();
     System.exit(1);
     }//end catch
     }//end finally
     }//end main
}//end Hw6Dbase

Similar Messages

  • Create a watchpoint for object attribute

    Hi experts,
    Does anyone know how to create a watchpoint for object attribute in the debug module?
    I've already created watchpoint for variables, but I don't manage to create for attributes, like -ATTRIBUTE_REF.
    I put -ATTRIBUTE_REF and the watchpoint dialog shows the type, however it doesn't accept the parameter.
    Regards,
    André

    Hi Andre
    When you create your watchpoint you only specify the object ref in "Variable". So you would enter only without the attribute name. Using the checkboxes in the centre of the watchpoint dialog box you can narrow down how many watchpoints are created. So if the attribute you are interested in is a private instance attribute then unselect all checkboxes but this one. This means that if the object has five private instance attributes then five watchpoints are created event though you are only interested in one of them.
    If you now go to the Break/Watchpoints tab you can double click on the "Details" icon and see the watchpoints created.
    Regards.
    Dave

  • Create an ArrayList

    Hi everyone, I am writing two classes :
    A customer account class: with method to create and manage the client account.
    (this is my constructor)
          * Create a new customer.
          * @param customerName
          *                               enter the name of the new customer.
          * @param bal
          *                     enter the cash amount.
         public CustomerAccount(String customerName, int bal) {
              this.customerName = customerName;
              balance = bal;
         }A customer base class: the collection of the customers.
    In this class I tried to create an ArrayList for my collection of customers, but it doesn't work.
    import java.util.ArrayList;
    public class CustomerBase {
         private ArrayList<CustomerAccount> customerList;
         public CustomerBase(){
              customerList = new ArrayList<CustomerAccount>();
         public void appendCustomer(String name, int bal) {
              CustomerAccount cust = new CustomerAccount(name, bal);
              customerList.add(cust);
         public int getNumberOfCustomer() {
              return customerList.size();
    }my method append customer doesn't work and I don't understand why.
    Can someone can help me ?
    Thank you,
    Henri

    My failure trace is :
    java.lang.NullPointerException
         at shop.Stock.<init>(Stock.java:12)
         at shop.CustomerAccount.<init>(CustomerAccount.java:16)
         at shop.CustomerBase.appendCustomer(CustomerBase.java:17)
         at shop.CustomerBaseTest.setUp(CustomerBaseTest.java:16)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:592)
         at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
         at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)I will have to go to bed now ( almost 3 o'clock in the morning); kevinaworkman thanks a lot for your help.
    Henri

  • Creating VO Dynamically and Copying Attributes

    Hi anyone,
    I've developed a SimpleSearch with LOVs that result in a multi-selection list.
    Once the rows are selected, I want to carry them over and display on the next page.
    I'm trying to keep it very simple, using OAFramework wizards an such but I'm struggling to get this accomplished, mostly due to lack of JAVA experience.
    I was trying to follow the advice from "How to show selected rows only in tablebean" but I don't know how to create a VO dynamically and am new to JAVA (which is why I tried to keep it simple).
    What I need help with desperately is:
    1) The correct syntax/code for creating a simple VO dynamically - examples in the OA Dev guide are hard to follow.
    2) Correct syntax/code for copying attributes using setAttribute().
    3) Does this new VO appear under the BC4J Components directory? If not, how do I attach it to the table's columns?
    4) Anything else I should include or watch out for?
    Thanks very much.

    Hi Ramkumar,
    I did create a VO declaratively before but am stuck on syntax again in the AMImpl.
    I'm getting the error: oracle.jbo.TooManyObjectsException: JBO-25013: Too many objects match the primary key oracle.jbo.Key[10006 ].
    Could you look at my code and see what is missing?
    public void SelectItemInstance( )
    CustibSummaryVOImpl vo = getCustibSummaryVO1();
    CustibChangeVOImpl dvo = getCustibChangeVO1();
    Row[] sourceRows = vo.getFilteredRows("SelectFlag", "Y");
    // getFilteredRows returns a zero-length array if it finds no matches.
    if (sourceRows != null && sourceRows.length > 0)
    int numRows = sourceRows.length;
    for (int i = 0; i < numRows; i++)
    // For every row with a selected checkbox, we want call
    // the create( ) and insert()wrapper.
    Row newRow = dvo.createRow();
    newRow.setAttribute("ItemInstance", sourceRows.getAttribute("ItemInstance"));
    newRow.setAttribute("Item",sourceRows[i].getAttribute("Item"));
    newRow.setAttribute("TagNumber",sourceRows[i].getAttribute("TagNumber"));
    newRow.setAttribute("Client",sourceRows[i].getAttribute("Client"));
    newRow.setAttribute("Resp",sourceRows[i].getAttribute("Resp"));
    newRow.setAttribute("Service",sourceRows[i].getAttribute("Service"));
    newRow.setAttribute("Project",sourceRows[i].getAttribute("Project"));
    newRow.setAttribute("TCAAccount",sourceRows[i].getAttribute("TCAAccount"));
    newRow.setAttribute("OrderId",sourceRows[i].getAttribute("OrderId"));
    newRow.setAttribute("PartyId",sourceRows[i].getAttribute("PartyId"));
    newRow.setAttribute("AccountId",sourceRows[i].getAttribute("AccountId"));
    dvo.insertRow(newRow);
    } // end selectItemInstance()
    Thanks ever so much.

  • Entity created by method create_related_entity losing attribute referenz

    Hi all,
    I created a new Z-relation between the IS-U connection object an an own object (inherited from CL_CRM_GENIL_ABSTR_SO_HANDLER2) to handle customer specific data. It works fine except for one point. Existing data are handled well, I can modify and delete them. But if I add a new dataset with the method create_related_entity (in a event handler EH_ONNEW) to the connection object, there is a problem.
    The created entity seems to be ok, the attribute reference is filled and in the collection wrapper of the connection object, I could find the new entity as related. But in the getter-methods of the context node in view the attribute reference of the entity is initial (not bound). It is the same instance of entity class, but I don't know why and where the attribute reference is lost. In consequence, I'm able to create and save an initial entity (that I could modify in another session smoothly), but I'm unable to modify its values in the session in which it was created.
    Can anyone help me?
    Regards,
    Martin

    Hi Lisha,
    All you need to do it make sure that the parent entity is locked before creating the child entities through create_related_entity method.
    You can take a look at EH_ONCREATE method in BT111H_OPPT/ContactsOV  view of component BT111H_OPPT.
    (Alternatively just do a where-used list of the create_related_entity method and you will find many instances of the method in standard code in your system. Typically, it would be called in the event handlers for INSERT/CREATE or in the on_new_focus methods).
    * Lock the parent entity
      IF lr_entity->is_locked( ) = abap_false.
        IF lr_entity->lock( ) = abap_false.
          RETURN.
        ENDIF.
      ENDIF.
    * If lock is successful
      IF lr_entity->is_changeable( ) = abap_true.
            TRY.
    *           Create the related entity
                lr_entity = lr_entity->create_related_entity( iv_relation_name = 'BTPartnerBuyingCenter' ).
              CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel.
            ENDTRY.
    ENDIF.
    Regards
    Nisha

  • Creating a hierarchy in an attribute dimension using EIS

    we use EIS for our data/member loads.
    I have a couple of cubes with attribute dims and I had no problems using EIS to create those attribute dims as they did not have a hierarchy
    I have a new requirement to create an attribute dim with a hierarchy.
    I am not sure how can I do this in EIS. Please advice.
    I went through the chm file but could not really figure out anything about it.
    Thank you.

    Actually you can have hierarchies in your attribute dims in EIS, including text attributes. I have a number of models where we do this.
    It works the same as with regular dimensions. Assume you have a table with product codes and then a column for lev 0 attribute and lev 1 attribute.
    So code is XYZ
    Lev 0 attribute is Red
    Lev 1 attribute is Primary
    When you set up your attribute dim in EIS, set both attribute columns as attribute, then in the metaoutline model, drag lev1 attibute onto the outline, then drag lev0 attribute under it. You will get a warning that you can only associate the lev0 attribute with the base dimension, which is fine. Associate the lev0 attribute with the base dim as you normally would and build your outline.
    Your end result will be an attribute dim that looks like this
    Product Color
    --Primary
    ----Red

  • Create Playlists by file name attribute

    Hi,
    Somehow I have around 5000 songs that got duplicated.
    The duplicate files were named like this
    <filename>1.mp3
    So I would like to find just those *1.mp3 files from a playlist of duplicates that I created with one of "Doug's iTunes Scripts" called "Corral Itunes Dupes"
    And the kicker is that each duplicate song has the same 'date added' date+time as the original, so although I can find duplicates, I dont know which one to delete.
    Is there anyway to use the filename attribute in itunes to filter my current "Dupes" playlist in order to search for files ending in 1.mp3????
    Thanks,
    Bill Hart
    mac mini intel   Mac OS X (10.4.6)  

    OK,
    I think I have found the answer to my question, but it wasn't as clean as I would have liked. Beavis gave me some ideas, but ultimately I wanted to have iTunes do the deleting for me so that the database and filesystem was in sync the entire time. Due to the magnitude of the files involved I needed a batch system, the following did the trick with one caveat.
    1) First, run Doug's Scripts "Coral iTunes Dupes" http://www.dougscripts.com/itunes/scripts/ss.php?sp=corralitunesdupes
    2) Next run Doug's Scripts "Sundry Info to Comments" http://www.dougscripts.com/itunes/scripts/ss.php?sp=sundryinfotocomments
    This step is required. If there is a better way to do this please post it. What you want to do is attach the filename to the the commment section of each database record.
    Why? Because iTunes does not allow you to create smart playlists based off that information. For me, this information was necessary because the duplicates all ended in 1. You will want to tell this script to add the filename to the comments
    3) Then when you can create a smart playlist that uses the "Dupes" regular playlist and add in searching "comments" for 1.mp3 or 1.m4a or 1.m4p, however you want to filter your duplicates for deletion.
    4) Now you should add the column "Commment" to this playlist . This is optional, but I like to check to make sure I have the right songs, and not a bunch of real songs that actually end in 1 (maybe Stephen Malkmus's 1% of 1, for example).
    5) Now to delete files from a Smart playlist or regular playlist type option-delete. You should see the standard warning about keeping or deleting files etc. I wanted to delete the files so I choose "Delete files"
    6) Optional Go back to the Library and turn on "Show Duplicate Files" from the edit menu just to check you duplicate count and make sure it is in line with what you would expect.
    7) DONE!
    Hope this helps someone. Really, iTunes should have a facility to filter/search the library/playlists based on filename!
    Oh, and the 1 CAVEAT is that for the duplicated songs that you are keeping have the filename in the comments section. Oh well, deleting 7 GB of data was better than some strange comment info.
    Regards,
    Bill Hart

  • How to create a working day/holiday attribute in Time Dimension with OWB ?

    Hello everybody,
    I am trying with no success to create a Time Dimension (with the wizard it would be easier...) with a working day or holiday attribute (0 or 1) to be able to calculate measures only on working time !!! I am totally sure it's possible, obviously, but I found nothing on forums... Could you help me ??
    I use OWB 11g, I need all fiscal year/quarter/month/week and all calendar year/quarter/month/week attributes so without any wizard it would be quite impossible... thank you for your help !
    NB: of course I know how to define if a day is a working one or not, but I currently can't add any columns in Time dim created with wizard...
    Francois
    Edited by: [email protected] on Jun 15, 2009 8:24 AM

    Hi,
    First of all, thanks everyone for your help.
    I did several tests this morning.
    First of all, i've tried with time_from = 000000 and time_to = 235959 (23:59:59 CET) and the activity has been created with Time From = 04:00:00 and Time To = 03:59:59
    Strange no ??
    I've also tried with 230000 for time from and time to but the activity has been created with Time From = 03:00:00 and Time to = 03:00:00
    I cannot understand the logic behind....
    Thanks,
    Johnny Baillargeaux

  • Help in creating MDX Calculated Member using attributes from multiple Dimension

    Hi All,
    First of all my knowledge on MDX is basic. In one of our projects, there is a requirement to create calculated member (similar to derived fields in SQL) which is more of a dimension attribute and not really a calculated member. Due to IP issues I cannot paste
    the actual queries but I will provide an SQL Query equivalent to what I am trying to achieve:
    Select P.Product, Case When ISNULL(FS.ArtistName,'') = '' Then P.ArtistName Else FS.ArtistName End Artist
     From
    dbo.FactMusicSales FS
    Join dbo.dimProduct P
    on P.DimProductKey =  FS.DimProductKey
    We are trying to replicate the logic for derving the "Artist" field using MDX script.
    We are running into issues while trying to build an MDX expression using the above logic. The main issue being that the new field/member "Artist" would not be calculated unless its elements are selected (FS.ArtistName, P.ArtistName). Besides this
    we are also unable to place this new member in a different folder other than a sub folder under the measures. Any pointers to solving this would be really helpful.
    Thanks in Advance,
    Venki

    Hi Venki,
    According to your description, you need to create calculated member (similar to derived fields in SQL) which is more of a dimension attribute and not really a calculated member, right?
    In your scenario, you needn't to achieve this requirement by using MDX. You can use a named query on your data source view. A named query is a SQL expression represented as a table. In a named query, you can specify an SQL expression to select rows and columns
    returned from one or more tables in one or more data sources. So in you scenario, you can use your query on the DSV, and then use the modified table to create a dimension.
    http://msdn.microsoft.com/en-IN/library/ms175683.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • Create buld user and modify attributes

    Hi 
    I just started with powershell and really could need some help regarding creating bulk users accounts.
    I need to create new users with the follwing attributes filled in.
    GidNumer                         65050
    loginShell /bin/sh
    mssFU30name blblblbl
    uid hdfhdfhdh
    uidNumber 65555
    unixHomeDirectory           /home/1245
    I cannot find these attributes in Set-aduser.
    Is there a way in powershell that I can create new users by cvs and sets the needed attributes?
    Kind regards
    Rene de Vries

    Hi,
    Yes, you can use the -Add (or -Replace) parameter of Set-ADUser to set these values:
    http://technet.microsoft.com/en-us/library/ee617215.aspx
    If you want to set these values when you create the user with New-ADUser, look into the -OtherAttributes parameter:
    http://technet.microsoft.com/en-us/library/ee617253.aspx
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • Quickie - How to create a ArrayList Array?

    Hi,
    I hope this has a quick answer. What I'm trying to do is create an Array of ArrayList objects to replace a ragged array I had for strings. Basically the length of each 'row' of the array can be variable and I want to take advantage of ArrayLists features. So I created ArrayList
    as below:
    ArrayList[] headerInfo = new ArrayList[3];
    headerInfo[0] = new ArrayList<String>();  
    headerInfo[0].add("aString");If I iterate through each arrayList using a for each loop, will the order be preserved? Or is there a better way to achieve a 'variable length' ragged array?
    Thanks.

    Also, if you end up having to keep a large number of empty spaces in your lists/arrays (so that the "x" and "y" line up with the object you are trying to represent), you can try a Map to reduce the overall memory needed (because you won't need to keep a space for "x,y" pairs that don't have a corresponding value). Your key can be a String generated as:
    String key = x + "," + y;Then your map could be:
    Map<String, String> myStrings = new HashMap<String, String>();The getString method would be:
    return myStrings.get(x+","+y);or the key could be a simple class:
    [For a HashMap, you need hashCode--maybe add the hashCode provided by Integer class for x to the hashCode provided by Integer class for y--I don't know a lot about implementing hashCodes, but that sounds possibly reasonable.]
    class Pair {
       private final int x;
       private final int y;
       Pair(int x, int y) {
          // set values
       // define "equals" (x == other.x, y == other.y)
       // define "hashCode"
       // define "toString" for debugging purposes
    Map<Pair, String> myStrings = new HashMap<Pair, String>();The getString method would be:
    return myStrings.get(new Pair(x, y));For mathematics, if the 2-d array was a numerical matrix, this HashMap would implement what is called a "sparse matrix".
    The map doesn't change your other classes. The other classes would still call:
    String myString = someClass.getString(2, 4);

  • Can you create a product report with attributes?

    I have tried create a customer and orders report in order to show a list of people who have purchased classes..
    My product is setup as : SATURDAY CLASSES, with product attributes eg: JAZZ, BALLET, DRAMA etc
    When I run the report, it only shows the initial product, SATURDAY CLASSES, and no attributes.
    Report goes like this:
    Custom Reports > Add a Customer Report
    > Customers and Orders > Then I choose my fields required..  and Generate Report.
    I realise to fix this problem I could change the products to individual products and group them together, but that means the product discounts I have set up wouldn't work....
    Which makes it hard to see who has booked into which class..
    Is there any way to run a report that will show attributes?

    Our reports currently do not include product attributes. I believe that this item is on the wishlist so I would encourage you to go there and vote for it.
    Cheers,
    Mario

  • Is it a better practice to create an ArrayList at class level?

    Hello forum members,
    Of late one of my collegue suggested me to declare an ArrayList at class level and clearing the data for each method call as garbage collection is not guaranted in java and we may end-up with large pool of ArrayList objects on subsequent method calls!!!
    FYI :There was a need of an ArrayList object for a single method only.

    Bad suggestion. Variables should be declared in the scope in which they are used.
    Also bad reasoning. It needn't bother the programmer that garbage collection isn't guaranteed to run whenever a variable goes out of scope. It's sufficient that it is guaranteed to run before the program throws a OutOfMemoryError.
    That said, parts of the JDK instantiate an object as a class field and set (and subsequently access) its attributes in various methods to reduce the overhead of object creation for enhancing performance. Much of this is legacy code from the days of slower computers and less efficient JVMs and probably wouldn't be written the same way today.
    db

  • Howto create a commandLink and param-attribute in a self written renderer?

    Hi guys,
    I'm currently trying to write a JSF-component for a content-mangement-system.
    The goal of the component is to render a HTML-page which lists all elements
    of an article (with all things like text-components, pictures, headline etc.)
    and provides a link for every article-element which referes the user to a
    special JSF-site in which the selected article-component can be edited. For
    example: the user sees the site which lists all article-elements and selects
    a "edit this text-component button" from one text component. Aftter that he
    would be forwarded to a "editTextComponent.jsf"-Site which loads the selected
    component into a managed bean. The site "editTextComponent.jsf"-Site itself
    would then provide a JSF-form which fields are binded with the managed-bean
    properties. To do this I need my own component-renderer to create a special
    "command link" with an additional parameter of the selected component ID
    (similar to the <h:commandLink />- and <h:f:param />-Tags in a normal
    JSF-site). Because I need the ID of the selcted component in the new
    JSF-site.
    Now I need to know how I can pass such a parameter in a renderer. In a
    jsf-site I would simply do something like
    <h:commandLink action="myUser.accessRequestEditTextComponent">
    <h:outputText value="articleAdminPage.editThisTextComp" />
    <h:f:param name="componentID" value="myTextComp.databaseID" />
    </h:commandLink>
    But how can I do such a thing in a JavaClass??? I already tried a thing like
    public void encodeEnd(FacesContext ctx, UIComponent comp)
    writer.write(" <form
    action=\"../articlecomponents/createnewpiccomp.jsf\" method=\"get\">");
    writer.write(" <input type=\"hidden\" name=\"position\" value=\"" +
    textComponent.getID() + "\" />");
    writer.write(" <input type=\"image\" src=\"" +
    myUIArticle.getCreateNewIcon() + " \" />");
    writer.write(" </form>");
    But this is not working and it is very ugly because the url of the new site is
    hard-coded (and not a "action"-attribute which can be used in the
    faces-config.xml for navigation), I'm not able to pick out this attribute in
    the new jsf-site and the HTML-code is also hard coded.
    Can you guys give at least a little hint, a keyword to what I shall look for?
    I have defintly no idea and I'm already a little bit despaired.
    Greetings,
    Hendrik

    Okay, Martin from the myfaces-development-team has just anwsered my question. For all of you who have the same question: such a think that I'm trying to do is done in the "writeLink"-method in the HTMLCalenderRenderer-class of the myfaces-extensions. So take a look at this for an excelent example!

  • Unable to create change order for Operational attributes

    Currently we are in 11.5.10 E9 patchset.
    Product : Advanced Product Catalog
    Unable to find create change order button for any of the operational attributes page.
    Steps to reproduce :
    1.Switch to 'Development Manager' resp
    2.Navigate to 'Item Catalog' > 'Item simple search'
    3. Enter criteria to find an engineering item
    4. Navigate to the item details page.
    5. Select 'Inventory' or 'Manufacturing' or any other page.
    Could not find the create change order button.
    The profile option 'ENG: Engineering Item Change Order Access' is enabled to YES.
    Also, these operational attribute pages are not listed in Change order screen.
    Any pointers on this issue pls.
    Thanks in advance.
    Kumar.

    Dear Friend,
    Please check following config,
    1. Document pricing procedure assignment to ORDER TYPE ( VOV8 under Transaction flow for field Doc.Pric. Proc is
       maintained or not )
    2. Customer Pricing procedure assignment ( In Customer Master data under SALES Tab for Field  Cust.Pric. proc. is mainatined
          or not )
    3. Pricing procedure determination (Sales Area + Document pricing procedure + customer pricing procedure)
    4. Also chcek the condition is maintained for this combination.
    Regards
    AJIT K SINGH

Maybe you are looking for

  • How do I get the pictures from my iPhoto on my external Hard Drive to show up in the already existing iPhoto on my MacBook?

    I have an early 2008 MacBook. I had been using iPhoto on this MacBook until I purchased an iMac in 2011, at which time I copied my iPhoto Library from my MacBook to my iMac. Then I realized that my pictures and music were consuming the memory on my i

  • Reg:Error in Test Configure

    Hi Guys,            My sce is File to Rfc while testing in Test Configure in ID it giving error as Interface Determination and Operation Mapping not found but when i was trigger from RWB it Processed sucess,can anyone give me solution for this Error

  • Confused on my new BofA card

    I believe mine was charged within the first month or two. I know when the first statement cut and they reported to the bureaus, they did report the $39 fee. Keep your eye out for it, it will come. Edit: I just re-read your post. You definitely should

  • Problem with apply EHP3 on ERP 6.00

    When I am going to apply add-on SAP ERO 2005 Enhancement pakage 3  through SAINT. I am getting some prerequisite mismatch: FI-CAX,602 Non-permitted release of add-on FI-CAX installed EA-APPL,604 Non-permitted release of add-on EA-APPL installed EA-AP

  • Bookmarks are not sticking

    I have audio that I record with Audio Hijack Pro and they are saved as AAC bookmarkable. The actual filename ends with .m4a. I am losing the bookmarks. I just tried a test with a real audio book from audible and it did not save the last played locati