Complex Equation Loop Question

The code i have so far is
class MainApplication {
     public static void main(String args[]) {
          MathLib math = new MathLib();
          math.sumOfNumbers(2);
          math.sumOfNumbers(10);
          math.sumOfNumbers(200);
class MathLib {
     public void sumOfNumbers(int num) {
               int sum = 0;
               // put the loop in here
               System.out.println("sum = " + sum);
What you need to do is put a loop inside the sumOfNumbers() to calculate the sum of all numbers from 0 to the parameter passed.
For example, if the parameter is 2, the calculation is: 0+1+2 = 3.
For example, if the parameter is 3, the calculation is: 0+1+2+3 = 6.
For example, if the parameter is 4, the calculation is: 0+1+2+3+4 = 10.
and so on
I found a site http://mathforum.org/library/drmath/view/57919.html to help but couldnt figure it out.
I only need to modify the Mathlib class.
Im trying to get it to print out
sum = 3
sum = 55
sum = 20100

public class GaussLives
    public void sumOfNumbers(int num)
        System.out.println((num * (num + 1)) / 2);
    public static void main(String[] args)
        GaussLives gaussLives = new GaussLives();
        for (int i = 0; i < 20; i++)
            gaussLives.sumOfNumbers(i);
        gaussLives.sumOfNumbers(100);
}

Similar Messages

  • Solving the Complex Equations

    Any one help  me how to Solve the complex equation like this.. I was little confused bcoz imaginary part (j) is available..All  variables are known except j...
    Thanks & regards
    Rigil

    When you say "solve" do you mean, evaluate numerically or are you looking for an analytic solution?
    The numerical solution should be a straightforward translation of the equation to LV functions.  LV has  a complex data type which (a + ib) and most mathematical functions will accept it.
    LV is not really set up to do analytical solutions.
    Lynn

  • Can Numbers insert Complex Equations and show the Equation symbols

    In Excel for Windows it is possible to insert complex equations that looks like an image but shows
    all the symbols used in the equations. Excel will also use the same layout as it would look when written.
    So for example can 1/2 be turned automatically into a superscript subscript mathematical equation.
    Or can you insert a Square Route symbol into the equations.
    please help

    Kils wrote:
    So for example can 1/2 be turned automatically into a superscript subscript mathematical equation.
    This was already available in Numbers'08
    Or can you insert a Square Route symbol into the equations.
    This too
    But Numbers'09 adds the ability to insert MathType equations.
    Yvan KOENIG (from FRANCE samedi 10 janvier 2009 21:35:44)

  • Infinite Loop Question - should be simple

    Ok I think I have a simple question to ask here. I am attempting to create a program that creates an infinite loop for multiples of two...
    ex: 2, 4, 8, 16, etc...
    The math behind it is simple, x^2 when x = 2. I then want the result of each equation to be squared, and infinitely.
    Here is the code Ive written so far, I think Im close, but I may be way off... any hints or clues as to my next step would be appreciated.
    public class loopytest {
       public static void main (String[] args)
       int x = x^2;
       while (x = 2)
       System.out.println("Value of x is " + x);
    }

    int x = x^2;You have to initialise "x" first.
    You should give it an actual value (e.g. 2) for this case.
    int x = 2;If you want to get the value of x from arguments. (e.g. java YouProgram 2)
    You should change this part of code similar to the follow.
    int x = args[1];But this one hasn't used the Math.pow(), you should read the API and amend it.
    while (x = 2)This one is actually assign x with value 2.
    If you want to compare an int, you should use "A == B", "A.equals(B)" for Object.

  • Apple Loops Questions

    1) Where does Logic store user-created loops that I've added to the library?
    2) What is the easiest/best way to convert a regular .aiff or .wav file into an apple loop?
    3) I'm getting a lot of artifacts when I use loops I created--even when the loop is being played back at the same tempo as the original! Is this normal? You'd think that if the original cut was 120 BPM, and I turn it into an Apple loop, and stick it into another project at 120 BPM, there should be no artifacts, right?
    4) Sometimes when I click "add to loop library" Logic won't let me select "looping" as an option. This is after I've already analyzed the cut in Apple Loops Utility. What's up with that?
    Any help, insight or guidance would be appreciated.
    Thank you!

    zgogor wrote:
    1/ apple loops folder / check them ....
    I see folders for all Apple's loops and jam packs, but nothing for my loops.
    Edit: Found them They are at:
    ~/Library/Audio/Apple Loops/User Loops
    Before I was checking the root /Library, which is why I couldn't find them.
    2/ apple loop utility application / check it ...
    I have been using it, but considering the strange behavior I'm getting (see question #3 and #4) I think I might be missing a step or doing it wrong. Right now I open an audio selection in Apple Loops Utility, fill in the tags, mess around with the transient sensitivity, then "save." So why can't I add it as a loop after that?
    3/ no of course.
    Any idea what I might be doing wrong?
    4/ add to appleloop library doesn't mean it is converted, check appleloop utilty first then add them to the Lib
    I did use the loop utility first. I mentioned that in my original post.
    Message was edited by: Zachary Conlyn
    Message was edited by: Zachary Conlyn

  • ABAP Loop Question for next record

    Hello All, I am new to ABAP so please forgive this basic question. The below is a snippet of code I have in a ABAP Proxy.
    Here is a snippet of my code:
    DATA: ls_item    TYPE ZSHOPPING_CART_IN_BBP_PDS_SC_I.
    DATA: i_item     TYPE TABLE OF bbp_pds_sc_item_icu.
    DATA: w_item     TYPE bbp_pds_sc_item_icu.
    LOOP AT input-I_ITEM-item INTO ls_item.
        CLEAR w_item.
        w_item-guid = v_item_guid.
        w_item-parent = v_header_guid.
        w_item-description = ls_item-description.
        w_item-number_int = ls_item-number_int.
        w_item-category = ls_item-category.
        w_item-category_id = ls_item-category_id.
        w_item-product_type = ls_item-product_type.
      APPEND w_item TO i_item.
      ENDLOOP.
    The structure input-I_ITEM-item is an input from a ABAP Proxy. This all works great if I feed in only 1 line item to proxy, but if I send in two line items the result is i_item has line item 1 twice, and I get nothing for line item2. It is almost like the the loop runs twice but the ls_item stays on line 1. I am sure I am missing something simple.

    Here is a snippet of the XML I am sending to ABAP proxy:
    <I_ITEM>
         <item>
              <GUID>00000000000000000000000000055556</GUID>
              <PARENT>00000000000000000000000000055555</PARENT>
              <NUMBER_INT>0000000001</NUMBER_INT>
              <DESCRIPTION>Proxy Test Line</DESCRIPTION>
              <CATEGORY>268CA1C5BB9965449BED8C9B49484999</CATEGORY>
              <CATEGORY_ID>03000</CATEGORY_ID>
              <PRODUCT_TYPE>01</PRODUCT_TYPE>
         </item>
         <item>
              <GUID>00000000000000000000000000055557</GUID>
              <PARENT>00000000000000000000000000055555</PARENT>
              <NUMBER_INT>0000000002</NUMBER_INT>
              <DESCRIPTION>Proxy Test Line  2</DESCRIPTION>
              <CATEGORY>268CA1C5BB9965449BED8C9B49484999</CATEGORY>
              <CATEGORY_ID>03000</CATEGORY_ID>
              <PRODUCT_TYPE>01</PRODUCT_TYPE>
              </item>
    </I_ITEM>

  • Garage Band LOOPS question

    Hi,
    I guess this question can apply to both Logic and GarageBand. When using loops am I locked into the "key" that they appear in? What I mean is this. Let's say I make a song in Amajor in 4/4 time. At that point all my loops appear in the key of A. The problem arises when I want to take the chord progression maybe from I - IV - vi - V - I or something. My question is... can I make those same loops play the appropriate chord for the key signature?
    I hope this makes sense.
    Thank you for any help you can offer.
    B.

    ..I'm not exactly sure what you're asking. But..All the apple loops I've encountered have a series of different notes in one key. You can transpose them, but then not all of the notes in that loop will sound good with the original key. Does that make sense? For example...if you have a loop in A, then play the loop again in D (the IV of A)..it's likely it will contain G natural...a note that occurs in the key of D, but would sound bad in A.
    On top of that..most apple loops are simply melodies. I would recommend layering one of them on top of a bass or piano or synth you'd recorded that would play the chords you want in your song.
    Hope this answers your question.

  • Switching loop question

    Hello everyone!
    I need some clarification of the switching loops. I apologise if my question is too simple, but i really cannot find answer in books, internet. Thanks in advance!
    Please look at the attached topology. This is my test lab for switching loops learning. For simplification purpose IPs, MACs and interface's names were shortened (FF=FF:FF:FF:FF:FF:FF).
    Initial conditions:
    SW-1:
    Cisco Catalyst 3750-V2, 12.2(50)SE5 IPServices, with default, factory config.
    For an unmanaged switch simulation purpose, interfaces 1/1, 1/2, 1/3, 1/4 were configured with switchport host macros and spanning-tree bpdufilter enable command (additional to default factory config).
    Interfaces 1/2 and 1/3 were interconnected with straight through patch cord specifically for creating a switching loop. Just booted up, not learned any MAC-address.
    SW-2:
    Cisco Catalyst 3750-V2, 12.2(50)SE5 IPServices, with default, factory config.
    Just booted up, not learned any MAC-address.
    Both PCs:
    Have a clear ARP-cache.
    Test:
    PC-1 sent ICMP-echo to PC-2. SW-1 received an ARP-request from MAC A (MAC-address of PC-1's NIC) to MAC FF (L2 broadcast as mentioned before) on its 1/1. Because of the initial conditions there is broadcast storm now. MAC A is flapping between 1/2 and 1/3. Next, PC-2 received an ARP-request from MAC A and sent ARP-reply. That ARP-reply arrived at SW-1 and started unicast storm additional to broadcast storm.
    This is clear for me.
    Question:
    What i don't understand is why the SW-1 sends ARP-reply from PC-2 back to the SW-2 (interface 2/1)?
    P.S. apologise for my english. Thanks again!

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    If there's only one or two non-STP switches, in a full mesh, you'll be okay.  Once you have at least three non-STP switches, in a full mesh, you have a loop between them.

  • Cursor For loop question

    Hi,
    I have a cursor in my plsql and I am trying to get the record through a FOR loop. I know that for loop will take care of opening, fetching and closing the cursor implicitly.
    Ex.
    declare
    cursor c1 is
    select * from emp;
    begin
    for l_rec in c1 loop
    end loop;
    My question is i want to check whether the cursor in the for loop is returning any record or not using IF condition.
    where and how i will find that?
    Can anyone help how to do that.
    Rds,
    Nag

    without using boolean variables.Obvious question, WHY?
    If you are so particular..
    SQL> declare
      2   cursor c1 is
      3        select empno, ename, job
      4        from emp
      5        where empno = 7839123;
      6   ex exception;
      7   rec c1%rowtype;
      8  begin
      9   open c1;
    10   fetch c1 into rec;
    11   if c1%notfound then
    12    raise ex;
    13   end if;
    14   loop
    15    dbms_output.put_line(rec.empno||'-->'||rec.ename||'-->'||rec.job);
    16    fetch c1 into rec;
    17    exit when c1%notfound;
    18   end loop;
    19  exception
    20   when ex then
    21    dbms_output.put_line('cur not found');
    22  end;
    23  /
    cur not found
    PL/SQL procedure successfully completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • VERY IMPORTANT FOR LOOP QUESTION

    public class ForTest2 {
         public static void main(String args[]) {
              int i=0, j = 0;
              for (j=0; j < 10; j++) {
                   i++;
                   System.out.println("i is: " + i);
                   System.out.println("j is: " + j);
              System.out.println("Final i is: " + i);
              System.out.println("Final j is: " + j);
    }j ends up being 10. Why? It should only be 9. This is as when j is 10 the for loop fails, so j++ shouldnt happen.

    First, please, please, please stop using all caps. It's extremely annoying.
    Second, don't mark your question as urgent or important. It is 100
    % guaranteed NOT to get you help any faster, and it might just delay you getting help because it's annoying.
    As for your question, you're misunderstanding how the for loop works. j HAS to become 10 for it to end. The loop body executes as long as j < 10. If j didn't become 10, the loop body couldn't terminate, because j<10 would always be true.
    The body is executed, the j++ is executed, then the j<10 is tested.
    int j;
    for (j = 0; j < 10; j++) {
        // body
    // is equivalent to
    int j;
    j = 0;
    while (j < 10) {
        // body
        j++:
    }

  • Procedure Body Loop Question

    I have a procedure that builds an Excel Spreadsheet from a parameter form, depending on the user's selected criteria. To make it easier for testing I am just selecting a range of 3 leases from this form. Each lease may have several entries according to the number of invoices. I am trying to put a total and a blank line between each lease group, but I'm having a problem with how to loop it.
    Below is the code:
    CODE
    PROCEDURE Excel_ReportData ( v_cl_no varchar2,
    v_pr_no varchar2,
    v_ls_date date,
    v_beg_no varchar2,
    v_end_no varchar2 ) is
    cursor c1 ( v_cl_no varchar2,
    v_pr_no varchar2,
    v_ls_date date,
    v_beg_no varchar2,
    v_end_no varchar2 ) is
    select tran_type, lease_no, tran_no, tran_date, dscr, amount, ar_col, ap_col,
    lease_date, cl_no, pr_no, ls_no
    from lease_transactions a, lease_master b
    where b.ls_no = a.lease_no
    and b.cl_no = decode( v_cl_no, null, b.cl_no, v_cl_no )
    and b.pr_no = decode( v_pr_no, null, b.pr_no, v_pr_no )
    and b.lease_date = decode( v_ls_date, null, b.lease_date, v_ls_date )
    and nvl(b.ls_no,0) between nvl(v_beg_no,-100) and nvl(v_end_no,9999999999)
    order by 2, 4;
    cursor c2 ( v_cl_no varchar2,
    v_pr_no varchar2,
    v_ls_date date,
    v_beg_no varchar2,
    v_end_no varchar2 ) is
    select lease_no, nvl(sum(ar_col), 0) ar_sum, nvl(sum(ap_col), 0) ap_sum
    from lease_transactions a, lease_master b
    where b.ls_no = a.lease_no
    and b.cl_no = decode( v_cl_no, null, b.cl_no, v_cl_no )
    and b.pr_no = decode( v_pr_no, null, b.pr_no, v_pr_no )
    and b.lease_date = decode( v_ls_date, null, b.lease_date, v_ls_date )
    and nvl(b.ls_no,0) between nvl(v_beg_no,-100) and nvl(v_end_no,9999999999)
    group by lease_no
    order by 1;
    cr1 c1%rowtype;
    cr2 c2%rowtype;
    v_i number;
    v_no number;
    v_name varchar2 (20) := 'Lease_Trans';
    v_tran_type varchar2 (50);
    v_lease_no varchar2 (20);
    v_tran_no varchar2 (100);
    v_tran_date date;
    v_dscr varchar2 (500);
    v_amount number;
    v_ar_col number;
    v_ap_col number;
    v_lease_date date;
    BEGIN
    Oleexcel.sheetname := 'Sheet1';
    OleExcel.OpenSheet;
    Ole2.release_obj( oleexcel.worksheet );
    OleExcel.LineWeight := 0;
    -- Insert new worksheet in front
    oleexcel.sheetname := v_name;
    Oleexcel.NewSheet;
    Excel_PageSetup( 2, 5 );
    -- Build Header
    v_i := 1;
    ac.counter := 0;
    OleExcel.Set_Cell_ValFullFmt( v_i, ac.nxt, 'T. S. DUDLEY LAND COMPANY, INC.', null, 'Arial', 14, 'Bold', null, OleExcel.cellWhite, false, OleExcel.Left );
    Blank_Cells( v_i, ac.counter+4, 52 );
    v_i := v_i + 1;
    ac.counter := 0;
    OleExcel.Set_Cell_ValFullFmt( v_i, ac.nxt, 'LEASE TRANSACTION REPORT', null, 'Arial', 10, 'Bold', null, OleExcel.cellWhite, false, OleExcel.Left );
    Blank_Cells( v_i, ac.counter+4, 52 );
    v_i := v_i + 1;
    ac.counter := 0;
    OleExcel.Set_Cell_ValFullFmt( v_i, ac.nxt, 'Date', null, 'Arial', 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    OleExcel.Set_Cell_ValFullFmt( v_i, ac.nxt, to_char( sysdate, 'MM/DD/YYYY'), 'MM/DD/YYYY', 'Arial', 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    Blank_Cells( v_i, ac.counter+1, 52 );
    v_i := v_i + 1;
    Blank_Cells( v_i, 1, 52 );
    -- Do Headings
    v_i := v_i + 1;
    OleExcel.LineWeight := 4;
    ac.counter := 0;
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Lease No.', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Transaction Type', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Transaction No.', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Transaction Date', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Transaction Description', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Transaction Amount', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Accounts Receivable', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Accounts Payable', null, 'Arial', 10, 'Bold', null, OleExcel.cellGray, true );
    v_i := 5;
    ac.counter := 0;
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '12' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '16' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '22' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '12' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '40' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '14' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '12' );
    oleexcel.Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, '12' );
    OleExcel.LineWeight := 2;
    OleExcel.Border_Cells( OleExcel.CellAddress( v_i, 1 ) || ':' || OleExcel.CellAddress( v_i, ac.counter ) );
    oleexcel.Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, '38.25' );
    v_i := 5;
    open c1 ( v_cl_no, v_pr_no, v_ls_date, v_beg_no, v_end_no );
    open c2 ( v_cl_no, v_pr_no, v_ls_date, v_beg_no, v_end_no );
    loop
    fetch c1 into cr1;
    exit when c1%notfound;
    fetch c2 into cr2;
    exit when c2%notfound;
    v_i := v_i + 1;
    ac.counter := 0;
    -- Output data
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, cr1.lease_no, null, 'Arial', 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, cr1.tran_type, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, cr1.tran_no, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr1.tran_date, 'MM/DD/YYYY'), 'MM/DD/YYYY', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Center );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, cr1.dscr, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr1.amount), '$###,##0.00', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr1.ar_col), '$###,##0.00', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr1.ap_col), '$###,##0.00', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right );
    oleexcel.Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, '15' );
    OleExcel.LineWeight := 2;
    OleExcel.Border_Cells( OleExcel.CellAddress( v_i, 1 ) || ':' || OleExcel.CellAddress( v_i, ac.counter ) );
    Blank_Cells( v_i, ac.counter+1, 52 );
    v_i := v_i + 1;
    ac.counter := 0;
    -- Output data
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, 'Total', null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, true, OleExcel.Left );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, null, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, null, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, null, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, null, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, null, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr2.ar_sum), '$###,##0.00', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right );
    oleexcel.Set_Cell_ValFullFmt ( v_i, ac.nxt, to_char(cr2.ap_sum), '$###,##0.00', 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right );
    oleexcel.Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, '15' );
    OleExcel.LineWeight := 2;
    OleExcel.Border_Cells( OleExcel.CellAddress( v_i, 1 ) || ':' || OleExcel.CellAddress( v_i, ac.counter ) );
    Blank_Cells( v_i, ac.counter+1, 52 );
    end loop;
    close c1;
    close c2;
    END;
    I've tried several different things, but this is the basic code, which is putting the totals at the end and only showing one lease when it should return 3 leases with multiple lines with the total line after each group.
    I've only been doing Oracle development for a few months so I hope this is an easy question.
    Thanks JLW

    PROCEDURE (some variables passed from form) IS
    cursor c1 is (select statement to get data to populate Excel spreadsheet)
    cursor c2 is (select statement to get totals for Total line in Excel)
    cr1 c1%rowtype;
    cr2 c2%rowtype;
    v_ ...
    Begin
    --Access Last Sheet
    --Insert New WS
    --Build Header
    --Build Column Headings
    *****Here is where I'm having the problem. I am trying to put a total and a blank line between each lease group.
    *****Not sure how to loop this ... sorry I'm a newbie.
    open c1;
    open c2;
    loop
    fetch c1 into cr1;
    exit when c1%notfound;
    fetch c2 into cr2;
    exit when c2%notfound;
    --Output Data from c1 (I need this to be only 1 lease group from c1)
    --Output Data from c2 (total from c2 with a blank line)
    ... and so on until c1-c2 notfound
    end loop
    close c1
    close c2
    end
    Below is an example of the output in Excel:
    ~*Lease No.* TransType Trans No. Trans Date Trans Description Trans Amount Accounts Receivable ~~*Accounts Payable*~
    ~812320 Invoice 681050 7/23/2008 68105 $3,156.55 $3,156.55 $3,156.55~
    ~812320 Check 35058 08/18/2008 County Clerk $17.00 $0.00 -$17.00~
    ~Total $0.00 $0.00~
    ~(BLANK LINE)~
    ~812327 Paid by Other 07/15/2008 $1,260.00 $0.00 -$1,260.00~
    ~812327 Bonus 07/15/2008 $1,260.00 $0.00 $1,260.00~
    ~Total $0.00 $0.00~
    Any help would be greatly appreciated.
    Thanks

  • Complex query/join question

    Not sure if this goes here, but I thought I'd try anyway.
    I'm using Oracle 8i for a legacy app and the RDBMS won't be updated anytime soon. I'm trying to write a fairly complex sum and join query. I have two different tables with hours worked type information. I need to be able to sum the hours for a work day on each table and put, in a web table like a GridView, all rows, even if there isn't a match in the opposite table. So, for example
    Table 1
    ID SHOP WORKDATE SHOPHOURS
    1 AM1 1/1/2008 4
    1 AM1 1/1/2008 4
    2 AM1 1/1/2008 8
    3 AM1 1/1/2008 8
    Table 2
    ID WORKDATE PAYHOURS
    2 1/1/2008 7
    3 1/1/2008 8
    4 1/1/2008 9
    What I need to see is
    ID SHOP WORKDATE SHOPHOURS PAYHOURS
    1 AM1 1/1/2008 8 0
    2 AM1 1/1/2008 8 7
    3 AM1 1/1/2008 8 8
    4 1/1/2008 8 9
    Since i'm on 8i, I can't use a FULL OUTER Join, so i'm kind of stumped. Any suggestions would be greatly appreciated.

    You might want to post this to question to [SQL Forum|http://forums.oracle.com/forums/forum.jspa?forumID=75] instead for better result, but i can give you a solution. This is definitely not the best solution, but it works.
    select nvl(table1.id,table2.id) id, shop,
      nvl(table1.workdate,table2.workdate) workdate,
      sum(nvl(shophours,0)) shophours, sum(nvl(payhours,0)) payhours
    from table1, table2 where table1.id(+) = table2.id
    group by nvl(table1.id,table2.id), shop,
          nvl(table1.workdate,table2.workdate)
    union
    select nvl(table1.id,table2.id) id, shop,
      nvl(table1.workdate,table2.workdate) workdate,
      sum(nvl(shophours,0)) shophours, sum(nvl(payhours,0)) payhours
    from table1, table2 where table1.id = table2.id(+)
    group by nvl(table1.id,table2.id), shop,
          nvl(table1.workdate,table2.workdate) Cheers,
    [Nur Hidayat|http://nur-hidayat.net]

  • Apogee ONE ground loop question

    Sorry that this is not directly related to Logic. My question is about why one audio interface has a ground loop issue when another one does not in the exact same setup. Details:
    Previously using an Edirol UA-5 as a USB interface. 1/4" outputs in the back connected directly to a pair of powered monitors. Monitors are plugged into a power strip that connects to a different outlet than my computer. No ground loop hum.
    Recently tried to replace the UA-5 with an Apogee ONE USB interface. Changing nothing about my configuration other than 1.) plugging the ONE's USB cord into the port where the UA-5 was plugged in and 2.) using a splitter on the ONE's stereo 1/8" output to connect it directly to the powered monitors. Total hum and high-pitched whine through the monitors.
    Leaving the ONE in place, I inserted one of those cheap 3 prong to 2 prong adaptors at the wall outlet for the monitors' power strip. Hum and whine disappeared.
    So my question is: what does this tell me about these two interfaces? Which one has the problem? Given that the ONE is more expensive and of supposedly better quality, I would have expected it to be more tolerant of things like ground loops than the UA-5. Or is my understanding wrong? Is there some spec or sensitivity that is desirable but that renders the device susceptible to ground loops that I don't know about?
    I don't know if I should be disappointed or not!

    More info:
    1. When I use a 2-3 prong adaptor on the the power strip that powers the monitors and connect the monitors to the ONE, a power outlet tester plugged into the strip shows a "correct" connection, which means it is grounded correctly.
    2. When I use the 2-3 prong adaptor on the the power strip that powers the monitors and do NOT connect the monitors to the ONE, the power outlet tester plugged into the strip shows an ungrounded connection.
    To my understanding, that's a lot of evidence that the monitors are being grounded through the ONE. Anything else I should try?
    Strangely (to my understanding), when I plug the power strip that powers the monitors into the power strip that powers the computer, I get all the hum and whine again. In addition I get a mid-range-y constant chatter, almost like a fan noise. If I use the 2 to 3 prong adaptor to connect the monitor power strip into the computer power strip, the hum and whine go away, but the mid-range chatter stays. I had thought the hum and whine would not have happened since I think there was only one path to ground. Any thoughts about that?
    Message was edited by: Will Rees

  • Stupid WHILE loop question

    A=0
    While A<B
    BEGIN
          Set B=B+1
         ...statements
    END
    If B had been = to 1 would the loop process through to the END or exit as soon as B was incremented?

    The best way to learn this would be trying by yourself.
    Hint: Based on what you posted (B = 1) you will need to learn the keyword BREAK.
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • A simple for loop question

    Hi
    Lets say I have an array with boolean values in it:
    my_array = [ false , false , false ]
    My question is:
    How do you make a function to check, if the value is all
    false, than do this (not only one but all false than trigger a
    function)
    thank you

    The 350Z,
    > Lets say I have an array with boolean values in it:
    > my_array = [ false , false , false ]
    I'm with ya.
    > My question is:
    > How do you make a function to check, if the value is
    > all false, than do this (not only one but all false than
    > trigger a function)
    Your subject line already states the answer. A for loop
    would come in
    handy. :) In your case, you're looking for all three values
    to be false.
    If even a mere one of them is true, the whole result doesn't
    count. Let's
    write a function that returns true if all three are false,
    and returns false
    if any are true.
    function checkWholeArray(arr:Array):Boolean {
    for (var n:Number = 0; n < arr.length; n++) {
    if (arr[n] == true) {
    return false;
    return true;
    To use this function, you could call it and supply your
    array as the
    parameter ...
    checkWholeArray(my_array);
    ... and since that resolves to either true or false, you
    could even use that
    expression in an if statement.
    if (checkWholeArray(my_array)) {
    // do something
    } else {
    // do something else
    The for loop simply steps through each element in the
    passed-in array.
    If the current element is true, then the desired outcome --
    that all
    elements are false -- is a loss, so the function returns
    false and
    immediately stops (the return statement always exits the
    function at that
    point). Otherwise, the for loop finishes, and the function
    returns true.
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

Maybe you are looking for

  • CCA data upload----s_alr_87013613

    HI All, I have uploaded Cost element/ cost center planned data through one of our Ztcode....It showed success message, but when i checked in t-code: s_alr_87013613 for planned data....it was blanck......can someone give a me clue what could be the re

  • Document Output - PDF-based forms - output log (error)

    Hello, Ever since activating the PDF-based form for BUS2201 the following error shows via viewing the 'output log': E     Business AddIn Was Not Called     http://srm7.atosorigin-ica.com:80/sap/ebp/docserver?msgdocuget&MsgId=SPPF_MEDIA&MsgNo=038&Lang

  • Could not follow any document

    As in the title I couldn't follow any document or site. once I click follow button something like something went wrong Sorry, we couldn't follow the document. Technical Details Unexpected response from server. The status code of response is '500'. Th

  • Console output on jspx page

    Hi all, Does anyone know how to display information on the console? I've tried using jsp scriptlet it can't work. Is this correct? <jsp:directive.page contentType="text/html;charset=UTF-8 " import="java.io.*" /> Thanks Gavin Edited by: user8866620 on

  • How many break points and watchpoints are allowed in ECC 6.0

    Hi, Can any one say how many break points and watchpoints are allowed in ECC 6.0