Rounding to 1000 no decimals

Hi Gurus..
    In my report I want to see the KEY FIGURES rounding to 1000, I dont want the decimals to be displayed how do I do that... Thanx...
Preethu

Hi Preethu,
In your Key figure properties you can set the scaling factor and also the number of decimal places. This can be done in the query or also at the workbook level.
Hope this helps...

Similar Messages

  • OBI rounding off to 2 decimals

    I just created a a simple request with a dumy column and one column and gave the calculation for this column as 23/12.6. The result returned is 1.83. Why the result is rounding off to two decimal places?
    thx.

    hi parag,
    Obiee internally rounds it off to 2 decimals....for the calculation you mentioned 23/12.6 gives you big number after decimal something like 16 digits.
    If you want check it out with select 23/12.6 from dual (OR)
    if you want to round your preferred decimal check with this query select round(23/12.6,5) from dual
    Hope it helps you.
    By,
    KK
    Edited by: KK on Oct 21, 2010 11:15 PM

  • Validation Pattern: requiring decimals

    ISSUE ONE:
    I want to have users input a number to the nearest hundredth - concerning grade point averages. For instance, if the number is 2.96, I do not want users to input 3.0. They must have two decimal places. How do I do this?
    ISSUE TWO:
    In reference to issue 1, how do I make sure if they try to input more decimals that it automatically rounds to two? For instance, if the user tries to input 2.9599, I want it to round to 2.96. Can this be done?

    Here is the entire solution.....
    use a numeric field with data Display Pattern, Edit Pattern and DataPattern similar to zzzzzzzzzzzz9.999
    and then have the following JavaScript code in exit event (may have to customize as required).
    var val = this.rawValue
    this.rawValue = Math.round(val*1000)/1000; //answer for send question
    //answer for first question starts here
    val = this.formattedValue;
    var myDot = val.indexOf(".");
    var rDot = val.substring(myDot+1);
    //xfa.host.messageBox(""+rDot);
    if (rDot == "000") {
    xfa.host.messageBox("Integer values are not allowed.");
    xfa.host.setFocus(this.somExpression);
    Good Luck,
    SekharN.

  • BW Report - Rounding Quantities

    Hi:
    I have a report with a quantity field.  When I view the quantity in the cube the value contains 3 decimals. However, when I run the query in Bex or Web, the quantity is rounded off and my decimals show as zero.
    Example:  Invoice Quantity = 168.650.  the report will display 169.000.  Invoice Quantity is define as a quantity; data type is Quan.  Unit/currency is 0PO_Unit.
    In the query, in the properties of Invoice Quantity  I have set up as the following:  Under "Number Format" - Scaling Factor is set to 1.  "Number of Decimal Places" is set to 0.000.  I don't understand why this is not working properly.
    Does anybody have any ideas why it's rounding instead of showing the decimals?
    Thanks in advance for your help!
    Regards,
    Helena

    Hi Eugene:
    In Table T006 I have a UOM "VAL" with Measure unit text "Value" and Unit Text "Monetary Value".  The decimal pt.rnd. is 0.  The dimension is "ZEACH". Also, the ISO Code is blank. When I execute transaction CUNI, it brings me to an Initial Screen.  In this intial screen it contains 3 tabs: Dimensions, ISO Codes, and Unit of Measurement.  Next to the Unit of Measurament it has a drop down.  If I select ZEACH, and click on Unit of Measurement, I get the entry that I'm interested in.  It has:  Unit = Val; Commercial = Val; Technical = Value; Meas. unit text = Value.  If I highlight and then click on more details button, I get the details screen.  Under "Display" Decimal places is blank.  Under "Conversion", Decimal pl. rounding is also blank.  And "ALE/EDI" ISO Code is also blank.  So in summary the culprit here is table T006.  Table T006 needs to be adjusted in R/3 so that when it gets fed to BW is correct.  The questions is how to modify T006?  Is this considered a configuration issue?
    Regards,
    Helena

  • Re:Total(LC) Rounding off issue in Sale Order document ..!!!

    Dear SAP Members,
    My end user facing a issue while entering the sale order.The scenario is,For a item say 'X',its quantity is 24,unit price is 41.15,discount is 8%,then the total amount (ie)Total (LC) should be 908.59, but the system shows as 908.64.Why I'm getting this issue.
    I have given Rounding Method by currency.
    Display settings as:
    Amount-2
    Price-2
    Rates-4
    Quantities-2
    Percent-6
    Units-2
    Currency settings:
    Rounding Method-Round to one.
    Decimals-Default
    I have tried all possibilities in test database but still I'm facing the same issue..
    Please give me solution to solve this issue.
    With Regards,
    Revathy

    The software's logic is as follows it calculates the unit price after discount then times that rounded amount to the quantity. That is also why there is net unit price on the row level if you look in the DB. You could do a manual adjustment on the total but that will play abound with the discount a bit. Business one logic is very relational and because of the cascading of header tables and row level tables the calculations are not intuitive to most users. But on the upside you are guarantee consistent rounding by the software across the board.

  • Rounding to nickel formula...

    Hi,
    I have a formula for rounding a value to the nearest nickel. It seem that it does'nt work propably. The value of tempCalc after calculation is 3245.421123 and the result should be 3245.40 but I receive 3245.45 instead.
    // round to the closest nickel (0.12 ==> 0.10 and 0.13 ==> 0.15)
    private double RoundToNickel(double amontValue)
    double tempCalc;
    int modCalc;
    tempCalc = ((double)(Math.round(amontValue*100)));
    modCalc = (int) tempCalc % 5;
    switch (modCalc)
    case 1:
    tempCalc = (tempCalc / 100) - .01 ;
    break;
    case 2:
    tempCalc = (tempCalc / 100) - .02;
    break;
    case 3:
    tempCalc = (tempCalc / 100) + .02;
    break;
    case 4:
    tempCalc = (tempCalc / 100) + .01;
    break;
    default:
    tempCalc = tempCalc / 100;
    break;
    tempCalc = ((double)(Math.round(tempCalc*100)))/100;
    return tempCalc;
    So I try the next one and the problem is that I receive 3245.40 but if I try with an other value I receive 3245.425 for example.
    private double RoundToNickel(double amontValue)
    double tempCalc;
    // Test for rounding issues
    double tempdouble;
    // Determine the single cents
    tempdouble = (amontValue * 10) % 1;
    tempdouble = ((double)(Math.round(tempdouble * 1000)))/1000;
    if (tempdouble > .5) {
    tempCalc = amontValue + (((.5-tempdouble)* -1)/10);
    } else {
    tempCalc = amontValue - (tempdouble / 10) ;
    return tempCalc;
    Is there someone who can help me with this.

    This should be what you want. Note that I coded it using binary floating point throughout, which is the cause of the "unusual" format of the results. This can be cured by formatting the results with DecimalFormat class.
    There is a very small (by finite) possibility that an input will disrupt the code, again due to the imprecision of binary floating point numbers in representing decimal numbers. This probablilty can probably be ignored for practical purposes.
    for(x = 0; x < 21; x++)
    //-------Code starts here. Provide a value for inout.
    double input = .01*x;
    double nickels = input * 20;
    double roundedNickels = (nickels - (int)nickels < .5) ? Math.floor(nickels) : Math.ceil(nickels);
    double roundedOutput = roundedNickels * .05;
    //-------roundedOutput contains the rounding of the input to the nearest .05
    System.out.println("Input = " + input + "  Result = " + roundedOutput);
    }For illustration purposes I placed the code in a loop and printed the following results:
    Input = 0.0 Result = 0.0
    Input = 0.01 Result = 0.0
    Input = 0.02 Result = 0.0
    Input = 0.03 Result = 0.05
    Input = 0.04 Result = 0.05
    Input = 0.05 Result = 0.05
    Input = 0.06 Result = 0.05
    Input = 0.07 Result = 0.05
    Input = 0.08 Result = 0.1
    Input = 0.09 Result = 0.1
    Input = 0.1 Result = 0.1
    Input = 0.11 Result = 0.1
    Input = 0.12 Result = 0.1
    Input = 0.13 Result = 0.15000000000000002
    Input = 0.14 Result = 0.15000000000000002
    Input = 0.15 Result = 0.15000000000000002
    Input = 0.16 Result = 0.15000000000000002
    Input = 0.17 Result = 0.15000000000000002
    Input = 0.18 Result = 0.2
    Input = 0.19 Result = 0.2
    Input = 0.2 Result = 0.2

  • SQL subselect rounds unintentional in SAP B1

    Hey everyone,
    if I am executing a select-statement with a subselect in sap b1, the result of the subselect is rounded - why? If I run a query without other tables, I get the exact value.
    SELECT T0.[TransId], T0.[RefDate],
    (SELECT T2.Rate FROM ORTT T2 WHERE T0.RefDate = T2.RateDate AND T2.Currency = 'USD')
    FROM OJDT T0  INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId WHERE T1.[ShortName] = 'T0001'
    T2.Rate is rounded unintentional to two decimals and so further arithmetic operations are senseless because not exact. If I run the same query with Managment Studio, I get the exact value with four decimals. Several tries with CONVERT and CAST did not solve the problem.
    Any suggestions? Thank you!
    Best Regards
    Sebastian

    Hi,
    thanks for your reply. I have tried it out and you were right.. but the problem is, that I want to export the results into excel, but there the rounded values are exported.
    I have solved the problem by extending the where-clause and putting the T2.Rate into the normal select-clause.. then the values keep their format.
    Best Regards
    Sebastian

  • Problems with rounding keyfigures in Webi report

    Hi,
    we have the next scenario, we have a SAP BI connected to a Universe using XIR3.1 BO version ( with the integration kit).
    When we do a report with totals using the Webi the keyfigures results haven't the expected values, if we check the values in the cube (listcube) or by a SAP BI query we get the correct values.
    We have found that the difference comes from the moment the webi report do the rounding, when we filter the query by a excluding value it seems that the rounding is done at the level of the excluding object
    Example:
    We have the quantity sales (quantity 3 decimals) at the country level displayed without decimals, at that level the totals figures match with the data displayed in the infocube in SAP BI, when we filter excluding a customer of the country the figures don't match, the quantity sales are rounded at the customer level and then are aggregated, the customer is not displayed in the report.
      Report without excluding customer:
    WEBI report                                                             Infocube / SAP BI query 
       Country     Quantity                                                  Country     Quantity
        ES             287574                                                       ES             287574
        AD                1400                                                       AD                1400
    Report excluding customer  157
       Country     Quantity                                                  Country     Quantity
        ES             274456                                                       ES             273106
        AD                1400                                                       AD                1400
    To found were is the difference we have done a query including in the drilldown the customer, rounding at that level and doing the totals as the sum of that values we have the same values in the webi report and in the SAP BI Query and it is equal to 274456 In the other case if we sum the values of the customers without rounding and we round the total the values is the 273106.
    As the diffence it is great for the business, we need to found a way to do the rounding only in the level displayed in the report.
    We have expirience in other BO projects without sap integration and we have not found that issue, it is because that we included it in the forum of the SAP integration kit.
    Many Thanks in advanced.
    Nuria

    Hi experts!
    We have a similar problem to Núria and it persists after applying the instructions given by Stratos.
    Our scenario is BO Enterprise XI 3.1 SP2 and Integration Kit for SAP 3.1 SP2.
    I have a Universe connected to a SAP BW query 7.0. When I execute a report with WebI the results doesn't match.
    We found a problem rounding quantities. The curious thing is that only happens when the quantity is "UN". In this case rounds and truncates all decimals. So, if the Quantity is 0,45 UN in BW, in Webi report is 0.
    If the Quantity is in "KG" or "L" there aren't any problem. I've seen in the BW table SUNIT that the only difference is that the field "UN" its called "ST" in the table, what makes me think that maybe the problem is related to languages. But I have no idea.
    Any suggestions?
    Thanks in advance!
    Isaac

  • Rounding when using format-currency

    Hi all,
    We're using format-currency in several places in out reports. I.e.
    <?format-currency:ssLfBonusAmountContributing;'EUR';'true'?>
    When using this formatting we always get the value with 2 decimals.
    Is it possible to round and display without decimals?
    Regards,
    Hakan

    Hi all,
    Haven't anyone come across this issue, with currency-format and display value without decimals?
    I know that I can use number-format, but this is not then first option.
    Regards,
    Hakan

  • Regarding rounding the integer values.

    I have to round a type P decimals 3 value to type P decimals 2.
    can any one give me the syntax for this..

    DATA pack TYPE p VALUE '12345678'.
    WRITE pack NO-GROUPING ROUND 2 DECIMALS 4.
    The output of the WRITE statement is "123456,7800".

  • Issue Deployment rounding value & Fair Share

    Hello All,
           I have tested the deployment (SCM 7.0) with the rounding values and observed some strange results. Please find my cases below. And the deployment was executed on the production plant.
    Case 1:
    Location = DC1
    Demand = 5000
    Rounding Value= 1
    Location = DC2
    Demand = 3000
    Rounding Value= 1
    Location = PP
    Demand =0
    Stock= 1000
    Rounding Value= 1
    Location = DC3
    Demand = 2000
    Rounding Value= 1000
    Deployment Result:
    700 on DC1 and 300 on DC2
    Expected Result:
    625 on DC1 and 375 on DC2
    Case 2:
    Location = DC1
    Demand = 5000
    Rounding Value= 2
    Location = DC2
    Demand = 3000
    Rounding Value= 2
    Location = PP
    Demand =0
    Stock= 1000
    Rounding Value= 2
    Location = DC3
    Demand = 2000
    Rounding Value= 1000
    Deployment Result:
    700 on DC1 and 300 on DC2
    Expected Result:
    626 on DC1 and 374 on DC2
    Case 3:
    Location = DC1
    Demand = 5000
    Rounding Value= 1
    Location = DC2
    Demand = 3000
    Rounding Value= 1
    Location = PP
    Demand =0
    Stock= 1000
    Rounding Value= 1
    Location = DC3
    Demand = 2000
    Rounding Value= 1
    Deployment Result:
    500 on DC1, 300 on DC2 and 200 on DC3
    Expected Result:
    500 on DC1, 300 on DC2 and 200 on DC3
    Case 4:
    Location = DC1
    Demand = 5000
    Rounding Value= 1000
    Location = DC2
    Demand = 3000
    Rounding Value= 1000
    Location = PP
    Demand =0
    Stock= 1000
    Rounding Value= 1000
    Location = DC3
    Demand = 2000
    Rounding Value= 1000
    Deployment Result:
    1000 on DC1
    Expected Result:
    1000 on PP
    Master Data:
    Pull Deployment Horizon           : 28
    Fair Share               : A
    Push Deployment Horizon          : 999
    Only case 3 works as expected.
    Please let me know if I missing somethning.
    Thanks,
    Siva.
    Edited by: sivaprakash pandian on Nov 18, 2009 9:34 PM
    Edited by: sivaprakash pandian on Nov 18, 2009 9:52 PM

    Hi,
    I have compared the product location combination in MAT1 for DC2 and DC3, all of settings are same except Rounding value and Minimum Lot Size in subview Lot Size. Do you think it's because of the Rounding Value?
    I also checked the TL for DC1->DC2 and DC1->DC3, TLB Profile is difference between each other, but the total volume and total weight calculated with the value distributed proportionally from ATD Quantity is below than the constraint in  TLB profile. therefore I think TLB is no issue.
    Thanks & Regards,
    Quanyin Su

  • Fehlermeldung bei Round-Fkt im Formelblock

    Hallo,
    in einem Formelblock möchte ich die ankommenden Werte auf drei Nachkommastellen runden (DIAdem 11.1).
    Hierzu habe ich einen Formelblock eingefügt in dem ich folgende Formel eingegeben habe:  Round(D,3)
    Hierbei erhalte ich folgende Fehlermeldung:  "Fehler Innerhalb der Formel ..ROUND(DS3>,>3).. des Blocks Formel1 fehlt eine rechte Klammer"
    Was kann hier das Problem sein?
    Danke und Gruß,
    Tobias
    Solved!
    Go to Solution.

    Hallo Tobias,
    ich nehme an, du sprichst von DIAdem DAC.
    Im f(x)-Block können keine VBS-Befehle verwendet werden, sondern nur DIAdem eigene. Die Round-Funktion in VBS hat 2 Parameter - den Wert und die Nachkommastellen. Die gleichnamige DIAdem-Funktion hat nur einen Parameter - den Wert. Um auf 3 Nachkommastellen zu runden kannst du aber folgendes eingeben:
    Round(D * 1000) / 1000
    Gruß
    Walter

  • URGENT:: A Concern on output value in the report!!!

    Hi All,
    I have a concern on the following requirement:
    Business requirement :
               Total Dollar Value = (Actual Quantity – Book Quantity)  x  (Standard Price / Price Unit)
                      = (242 – 321) x  (5967.55 / 1000)
                      = (-79) x  (5.96755)
                      = - <b>471.4365</b> -> Currently we are getting this value
    Instead of Business wants the value like   - <b>471.44</b>  (Value is rounded of to 2 decimals)    
    Kindly let me know which function i need to use to get the value.
    Thanks in advance.
    Ramesh.

    *REPORT ZPRODUCT_ROLL .
    PARAMETER: p_value(20) TYPE c  default '-471.4365'.
    IF p_value LT 0.
        SHIFT p_value LEFT DELETING LEADING '- '.
        CONCATENATE '-' p_value INTO p_value.
      ELSE.
        SHIFT p_value LEFT DELETING LEADING ' '.
      ENDIF.
    DATA: d_value type p decimals 2,
          d_int1 TYPE i,
          d_int2 TYPE i,
          d_number(20)     TYPE c,
          d_num_result(20) TYPE c,
          d_decimal(2)     TYPE c.
    START-OF-SELECTION.
    d_number = p_value.
    SHIFT d_number LEFT UP TO '.'.
    SHIFT d_number LEFT.
    d_decimal = d_number+0(2).
    d_decimal = d_decimal + 1.
    Clear: d_number.
    d_number = p_value.
    SHIFT d_number RIGHT DELETING TRAILING '123456789 '.
    SHIFT d_number LEFT DELETING LEADING ' '.
    CONCATENATE d_number d_decimal INTO d_num_result.
    d_value = d_num_result.
    write:/ 'Value rounded up to 2 decimal places is ', d_value  .
    girish

  • Ragged/Jagged Arrays

    hey guys i was wondering if you guys could help me a bit^^.
    http://bingweb.binghamton.edu/~cs140/Homework/assignment06.html
    this is the assignment that i have to do and i am stuck on #3.
    here is my code for ArrayDataVer2
    package assig6;
    public class ArrayDataVer2
         private double[][] sourceArrayOfArrays;
         private double[][] targetArrayOfArrays;
         private double highestLength = 0;
         private int j = 0;
         private int numRows;
         private int i = 0;
         private double[][] twoDimArrVar;
         // This will show as unused until you write
         // the method fillOutTheArrays
         private double targetArraysFillValue = 0;
         * Make targetArrayOfArrays a rectangular array (i.e. not a
         * ragged array), with the same numbers of rows as sourceArrayOfArrays.
         * The number of columns of targetArrayOfArrays should be the maximum
         * length of the rows of sourceArrayOfArrays.
         * Also copy any values in sourceArrayOfArrays to the corresponding positons
         * in targetArrayOfArrays. Put targetArraysFillValue in all the other
         * positions of targetArrayOfArrays.
         * For an example, see the graphic in the assignment.
         public void fillOutTheArrays()
              //i is the array number
              //j is the size of the array number
         //     double[][] twoDimArrVar;                                                  //MAKING 2 ARRAYS INSIDE AN ARRAY
              //numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
              //twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
              //for (int i = 0; i < numRows; i++)
              //     int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
              //     twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
              //     for (int j = 0; j < length; j++)                                   
              //////          double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                        // now round it to 3 places of decimals
              ///          int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
              ///          twoDimArrVar[i][j] = k/1000.0;                                   //ADD
              double arrayTemp[];
              int x = 0;
              int arrayTempLength = 0;
              for (int i = 0; i < twoDimArrVar.length; i++)
                   arrayTemp = new double[twoDimArrVar[i].length];
                   arrayTemp = twoDimArrVar[i];
                   twoDimArrVar[i] = new double[(int)highestLength];
                   arrayTempLength = arrayTemp.length;
                   while (arrayTempLength <= (x + 1))
                        twoDimArrVar[i][x] = x;
                        x++;
                   while (arrayTempLength >= x)
                        twoDimArrVar[i][x] = (int)targetArraysFillValue;
                        //twoDimArrVar[i][x] = twoDimArrVar[i][targetArraysFillValue];
                        x++;
         * Find the maximum length of any "row" of the array of arrays
         * @param array a ragged two dimensional array
         * @return the maximum value of array[i].length
         *                over all rows i, where 0 <= i <= array.length
         public int maxArrayLength(double[][] array)
              int max = 0;
              return max;
         * Simple constructor uses a method to create a random
         * array of arrays
         public ArrayDataVer2()
              newArrays();
         * Call for the creation of the source array by using
         * <code>resetSizeAndContent</code> and
         * copy the source array to a new target array.
         public void newArrays()
              sourceArrayOfArrays = resetSizeAndContent();
              int numRows = sourceArrayOfArrays.length;
              targetArrayOfArrays = new double[numRows][];
              for(int i = 0; i < sourceArrayOfArrays.length; i++)
                   targetArrayOfArrays[i] = sourceArrayOfArrays[i].clone();
         * Create a two-dimensional array, i.e. an array of arrays
         * of random size containing random numbers at each position.
         * The array created is ragged
         * (every row can have a different length)
         * @return a random ragged 2-dimensional array
         public double[][] resetSizeAndContent()
                                                                //MAKING 2 ARRAYS INSIDE AN ARRAY
              numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
              twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
              for (i = 0; i < numRows; i++)
                   int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
                   twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
                   if (length > highestLength) highestLength = length;
                   for (j = 0; j < length; j++)                                   
                        double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                        // now round it to 3 places of decimals
                        int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
                        twoDimArrVar[i][j] = k/1000.0;                                   //ADD
              return twoDimArrVar;
    //     GETTER METHODS USED BY ArrayViewVer2
         public int getNumSourceRows()
              return sourceArrayOfArrays.length;
         public int getNumSourceColumns(int row)
              return sourceArrayOfArrays[row].length;
         public int getNumTargetRows()
              return targetArrayOfArrays.length;
         public int getNumTargetColumns(int row)
              return targetArrayOfArrays[row].length;
         public double getSourceArrayValue(int row, int column)
              return sourceArrayOfArrays[row][column];
         public double getTargetArrayValue(int row, int column)
              return targetArrayOfArrays[row][column];
         public void setFillValue(double d)
              targetArraysFillValue = d;
    when i try to run this, it comes up with multiple errors. does anyone know how to correct this?

    package assig6;
    public class ArrayDataVer2
         private double[][] sourceArrayOfArrays;
         private double[][] targetArrayOfArrays;
         private double highestLength = 0;
         private int j = 0;
         private int numRows;
         private int i = 0;
         private double[][] twoDimArrVar;
         // This will show as unused until you write
         // the method fillOutTheArrays
         private double targetArraysFillValue = 0;
          * Make targetArrayOfArrays a rectangular array (i.e. not a
          * ragged array), with the same numbers of rows as sourceArrayOfArrays.
          * The number of columns of targetArrayOfArrays should be the maximum
          * length of the rows of sourceArrayOfArrays.
          * Also copy any values in sourceArrayOfArrays to the corresponding positons
          * in targetArrayOfArrays.  Put targetArraysFillValue in all the other
          * positions of targetArrayOfArrays.
          * For an example, see the graphic in the assignment.
         public void fillOutTheArrays()
              //i is the array number
              //j is the size of the array number
         //     double[][] twoDimArrVar;                                                  //MAKING 2 ARRAYS INSIDE AN ARRAY
              //numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
              //twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
              //for (int i = 0; i < numRows; i++)
              //     int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
              //     twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
              //     for (int j = 0; j < length; j++)                                   
              //////          double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                        // now round it to 3 places of decimals
              ///          int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
              ///          twoDimArrVar[i][j] = k/1000.0;                                   //ADD
              double arrayTemp[];
              int x = 0;
              int arrayTempLength = 0;
              for (int i = 0; i < twoDimArrVar.length; i++)
                   arrayTemp = new double[twoDimArrVar[i].length];
                   arrayTemp = twoDimArrVar[i];
                   twoDimArrVar[i] = new double[(int)highestLength];
                   arrayTempLength = arrayTemp.length;
                   while (arrayTempLength <= (x + 1))
                        twoDimArrVar[i][x] = x;
                        x++;
                   while (arrayTempLength >= x)
                        twoDimArrVar[i][x] = (int)targetArraysFillValue;
                        //twoDimArrVar[i][x] = twoDimArrVar[i][targetArraysFillValue];
                        x++;
         * Find the maximum length of any "row" of the array of arrays
         * @param array a ragged two dimensional array
         * @return the maximum value of array[i].length
         *                over all rows i, where 0 <= i <= array.length
         public int maxArrayLength(double[][] array)
              int max = 0;
              return max;
         * Simple constructor uses a method to create a random
         * array of arrays
         public ArrayDataVer2()
              newArrays();
         * Call for the creation of the source array by using
         * <code>resetSizeAndContent</code> and
         * copy the source array to a new target array.
         public void newArrays()
              sourceArrayOfArrays = resetSizeAndContent();
              int numRows = sourceArrayOfArrays.length;
              targetArrayOfArrays = new double[numRows][];
              for(int i = 0; i < sourceArrayOfArrays.length; i++)
                   targetArrayOfArrays[i] = sourceArrayOfArrays[i].clone();
         * Create a two-dimensional array, i.e. an array of arrays
         * of random size containing random numbers at each position.
         * The array created is ragged
         * (every row can have a different length)
         * @return a random ragged 2-dimensional array
         public double[][] resetSizeAndContent()
                                                                //MAKING 2 ARRAYS INSIDE AN ARRAY
              numRows = 4 + (int)Math.round((6*Math.random()));               //DOING RANDOM = 4-10 ARRAYS
              twoDimArrVar = new double[numRows][];                                   //MAKING AN ARRAY WITH numRows ELEMENTS
              for (i = 0; i < numRows; i++)
                   int length = (int)Math.round((Math.random()*12));               //MAKE ARRAY LENGTHS FROM 0-12
                   twoDimArrVar[i] = new double[length];                              //MAKING THE ARRAY WITH AND INDEX OF SIZE LENGTH
                   if (length > highestLength) highestLength = length;
                   for (j = 0; j < length; j++)                                   
                        double d = 100*(Math.random() - 0.5);                         //CREATING A RANDOM NUMBER
                        // now round it to 3 places of decimals
                        int k = (int)Math.round(d*1000);                              //ROUND IT TO 3RD DECIMAL PLACE
                        twoDimArrVar[i][j] = k/1000.0;                                   //ADD
              return twoDimArrVar;
    //     GETTER METHODS USED BY ArrayViewVer2
         public int getNumSourceRows()
              return sourceArrayOfArrays.length;
         public int getNumSourceColumns(int row)
              return sourceArrayOfArrays[row].length;
         public int getNumTargetRows()
              return targetArrayOfArrays.length;
         public int getNumTargetColumns(int row)
              return targetArrayOfArrays[row].length;
         public double getSourceArrayValue(int row, int column)
              return sourceArrayOfArrays[row][column];
         public double getTargetArrayValue(int row, int column)
              return targetArrayOfArrays[row][column];
         public void setFillValue(double d)
              targetArraysFillValue = d;
    This is the error i get:
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 12
         at assig6.ArrayDataVer2.fillOutTheArrays(ArrayDataVer2.java:67)
         at assig6.ArrayViewVer2$FillOutArraysListener.actionPerformed(ArrayViewVer2.java:224)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • Days countdown from text file

    hi all. I'm using this script
    Code:
    this.createEmptyMovieClip("loader_mc", 0);
    loadVariables("assets/flash/splash/deadlines2.txt",
    loader_mc);
    // Variables declaration
    year;
    month;
    day;
    desc;
    // Check if variables text file are loaded
    function varLoaded() {
    if (loader_mc.y != undefined) {
    year = loader_mc.y;
    month = loader_mc.m;
    day = loader_mc.d;
    desc = loader_mc.desc;
    clearInterval(interval);
    // Then call function to calculate days difference
    diffDays();
    var interval = setInterval(varLoaded, 100);
    function diffDays() {
    var end_date = new Date(year, month, day);
    var tmp_date = new Date();
    var now_date = new Date(tmp_date.getFullYear(),
    tmp_date.getMonth(), tmp_date.getDate());
    var difference = end_date.getTime()-now_date.getTime();
    var daysleft = difference/1000/60/60/24;
    desc2.autoSize = "left";
    desc2.htmlText = !daysleft ? "<b>> Today" :
    "<b>> " + daysleft+(daysleft>1 ? " Days</b>" : "
    Day</b>") + desc;
    desc2.setTextFormat(new TextFormat("Verdana", 9));
    it acts pretty flaky, sometimes it works sometimes i get some
    weird results.
    if i put this:
    y=2007&m=2&d=23&desc= Deadline - Mar. 23, 2007
    into the txt file i get 23.9583333333333 Days. Which 23 isn't
    right even. plus i don't need any of those decimals. Any direction
    would be awesome.
    Thanks,
    Mike

    thanks so much for the advise. I used math.round and it
    worked great. i changed:
    var daysleft = difference/1000/60/60/24;
    to
    var daysleft = Math.round(difference/1000/60/60/24);
    Thanks,
    Mike

Maybe you are looking for

  • Upgraded to 9.3, imports don't work properly

    I recently upgraded to iPhoto 9.3. Ever since, when I import photos from my iPhone or camera, it creates an Event properly but it doesn't update the Last 12 months library. I know that's not a real library but it's the one I use the most. I tried fix

  • Dependent's Details workflow in ESS MSS

    Hello All , I am trying to create a workflow in ESS MSS which will be triggered from portal when employee will try to Add or change his dependent's details. Now my doubt is once employee is adding Dependent's details , it directly gets posted in Info

  • Applying tax in sales on excise applied (during purchased)

    Hi client is trader his scenario is: Purchases item at some cost and apply excise on that item and then add. Here purchase is finished. Now during sales he wants: While selling that particular item which he had purchase he wants to apply taxes like P

  • Reading UI mode and setting field mode in WebUI

    Hi Just getting into crm and I have some questions. How do I determine if a UI view is in create or change mode? How can i change a fields from input fields to display fields? The reason is I need to close 2 fields for input on the screen in change m

  • Macbook Pro Retina 13 inch Hinge Pop

    Hi, I had my 2 week old rMBP 13 inch exchanged for a new one, because the palm-rest was creaking excessively and was interfering with my work progress in quiet work conditions. However, this new one is even more irritating. Whenever I open my laptop