Pleazzz... help me put my record of the opening on the first line

I use this query inside my builder6 (oracle10g) report, but it is untimely return of output.
only when I give the start date of the report (: m_frm_date) as the opening date (op_date), the balance
the report that is stored in the table op_bal, happens correctly, with the first line, the opening balance.
later, when I try to run the same report giving other start dates, opening balance
line was traded to the second row. Please refer to the screenshot of my reports, for the best idea.
select op_date, TNO,OP_CODE,EI,withdrawal,deposit,
sum(NVL(DEPOSIT,0)-NVL(WITHDRAWAL,0)) over (order by op_date,TNO) bal
from
(
select op_date, NULL TNO,null OP_CODE,NULL EI,withdrawal,deposit
from
(
select  :M_FRM_DATE op_date, sum(withdrawal) withdrawal, sum(deposit) deposit
from
(
select :M_FRM_DATE op_date,sum(DECODE(EXPN_EI,'E',EXN_AMOUNT)) WITHDRAWAL,
sum(DECODE(EXPN_EI,'I',EXN_AMOUNT)) DEPOSIT
from EXPENSES_TXN, expense_master
where exn_acnt_code = expn_code
and exn_date < to_CHAR(:M_FRM_DATE,'dd/mm/yyyy')
union all
select op_date, null withdrawal, op_amount deposit
from op_bal))
union all
SELECT
EXN_DATE,
EXN_NO,
EXN_ACNT_CODE,
EXPN_EI,
DECODE(EXPN_EI,'E',EXN_AMOUNT) WITHDRAWAL,
DECODE(EXPN_EI,'I',EXN_AMOUNT) DEPOSIT
FROM EXPENSES_TXN, EXPENSE_MASTER
WHERE EXN_ACNT_CODE = EXPN_CODE
and EXN_DATE between to_CHAR(:M_FRM_DATE,'dd/mm/yyyy') and to_CHAR(:M_UPTO_DATE,'dd/mm/yyyy'))
order by op_DATE,tno
/
this is the actual for which report has to come;
SQL> select * from op_bal;
 
OP_COD OP_NAME            OP_DATE       OP_AMOUNT
------ ------------------ --------- -------------
OP0000 NATIONAL BANK      01-JAN-09      5000.000
 
*Date No.2*
SQL> SELECT
  2  EXN_DATE,
  3  EXN_NO,
  4  EXN_ACNT_CODE,
  5  EXPN_EI,
  6  DECODE(EXPN_EI,'E',EXN_AMOUNT) WITHDRAWAL,
  7  DECODE(EXPN_EI,'I',EXN_AMOUNT) DEPOSIT
  8  FROM EXPENSES_TXN, EXPENSE_MASTER
  9  WHERE EXN_ACNT_CODE = EXPN_CODE
 10  order by 1;
 
EXN_DATE         EXN_NO EXN_AC E    WITHDRAWAL       DEPOSIT
--------- ------------- ------ - ------------- -------------
01-MAR-09         2.000 AC0002 E      2000.000
10-MAR-09         7.000 AC0012 I                     500.000
15-MAR-09         5.000 AC0007 E        15.000
20-MAR-09         8.000 AC0012 I                     700.000
31-MAR-09         6.000 AC0008 E        30.000
01-APR-09         9.000 AC0013 I                     250.000
07-APR-09         1.000 AC0001 E       200.000
09-APR-09         4.000 AC0011 E        35.000
09-APR-09         3.000 AC0003 E        50.000
 
9 rows selected.
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT.jpg
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT1.jpg
http://S640.Photobucket.com/albums/uu123/fairoozxp/?action=view & Current = EXPRPT2.jpg

much appreciated, tyvm.

Hello

Is the problem that, when it is be a rank with exn_date =: m_frm_date, the line which represents the total front: m_frm_date sometimes appears after him?
If Yes, then you must add something to the ORDEER TO ensure that the total line comes first.
If NWT is NULL rfor only the total row, and then, as said to put, simply add 'NULLS FIRST' to "ORDER BY tno". Don't forget to do this as well in the analytical AGENDA BY:

OVER (ORDER BY op_date, tno NULLS FIRST)     AS bal

towards the beginning of your query and the result ORDER BY value at the end:

ORDER BY  op_date,
             tno          NULLS FIRST;

If reallly NWT can be null, you can create a new column (I'll call her sort_key) ust to distinguish the total line on the lines later. SELECT a literal 1 sort_key of ACE in the part of the UNION that created the total line, and then '2 AS sort_key' in the part of the UNION, who gets lines and after: m_frm_date:

SELECT     op_date, tno, op_code, ei, withdrawal, deposit,
     SUM ( NVL (deposit, 0)
         - NVL (withdrawal, 0)
         ) OVER (ORDER BY op_date, sort_key, tno)     AS bal
FROM
     (
     SELECT  TO_DATE (:m_frm_date, 'dd/mm/yyyy')        AS op_date,
          NULL                                  AS tno,
          NULL                            AS op_code,
          NULL                            AS ei,
          withdrawal,
          deposit,
          1                                        AS sort_key
     FROM
          (     -- Begin sub-query for expenses before :m_frm_date          SELECT  TO_DATE (:m_frm_date, 'dd/mm/yyyy')        AS op_date,
          SELECT     SUM (withdrawal)                        AS withdrawal,
               SUM (deposit)                          AS deposit
          FROM
               (
               SELECT     SUM (DECODE (expn_ei, 'E', exn_amount))     AS withdrawal,
                    SUM (DECODE (expn_ei, 'I', exn_amount)) AS deposit
               FROM     expenses_txn,
                    expense_master
               WHERE     exn_acnt_code     = expn_code
               AND     exn_date     < TO_DATE (:m_frm_date, 'dd/mm/yyyy')
               UNION ALL
               SELECT     NULL          AS withdrawal,
                    op_amount     AS deposit
               FROM     op_bal
               )
          )     -- End sub-query for expenses before :m_frm_date
     UNION ALL
     SELECT     exn_date,
          exn_no,
          exn_acnt_code,
          expn_ei,
          DECODE (expn_ei, 'E', exn_amount)     AS withdrawal,
          DECODE (expn_ei, 'I', exn_amount)     AS deposit,
          2                               AS sort_key
     FROM     expenses_txn,
          expense_master
     WHERE     exn_acnt_code     = expn_code
     AND     exn_date      BETWEEN  TO_DATE (:m_frm_date, 'dd/mm/yyyy')
                     AND       TO_DATE (:m_upto_date,'dd/mm/yyyy')
     )
ORDER BY  op_date,
             sort_key,
             tno;

Be sure to use strings to represent DATEs. If: m_frm_date is a string, it must always be used with TO_DATE and TO_CHAR ever.

Never, send or even write, unformatted code.
During the validation of code on this site, type the 6 characters
{code}
(small letters only, inside curly braces) before and after the code for formatting, to keep the spacing.

Tags: Database

Similar Questions

  • How to get the cursor to the first line after the addition of 3 rows in the OPS. Help, please.

    Hi Experts,

    I have a requirement to get the cursor should point to the first line instead of pointing to the third row. To the help of code below, my cursor points to the third row. Please put some light on it to reach the requirement

    XXCLKTestVOImpl vo = getXXCLKTestVO1();

    for (int i = 0; i < 3; i ++) {}

    Line = vo.createRow ();

    vo.insertRow (row);

    row.setNewRowState (Row.STATUS_INITIALIZED);

    }

    Thank you

    Gurnur Singh

    Problem is solved. Since then, I've been on 12.2.4 Ebs version and was auto insert false setting in AddtablerowBean. To reach the requirement, you will need to refer to the same number of lines to add the addtablerowbean property that you use in loop for. here I use 3 looping so you must use the number 3 lines to add the addtablerowbean property to get there. So whenever you add three rows then cursor in the first row of three lines you will add. Thank you all.

    Thank you

    Gurnur Singh

  • is there anyway to remove it saying that parental controls have been turned on for a user account? is not defeat the purpose of putting them on in the first place?

    is there anyway to remove it saying that parental controls have been turned on for a user account? is not defeat the purpose of putting them on in the first place?

    is there anyway to remove it saying that parental controls have been turned on for a user account? is not defeat the purpose of putting them on in the first place?

    Hello

    Why she would frustrate the object?

    If the child is a Standard recommended account and you are using an administrator account, the standard account cannot change Parental controls.

    Concerning

  • I have 10 items.  I'm trying to update camera raw plug so it will read the first lines of a 7dmarkii shot. I can't find where to put them to update to the latest version of 8.7.  If someone could please point me in the right direction.  Thank you very muc

    I have 10 items.  I'm trying to update camera raw plug so it will read the first lines of a 7dmarkii shot. I can't find where to put them to update to the latest version of 8.7.  If someone could please point me in the right direction, I would really appreciate it!

    Normally, I shoot with the 7dmarki and have never had any problems.  After troubleshooting my error message 'cannot open IMG1111 because it's the wrong file type', only the options have been updated plugin raw from the camera, to buy the latest version or uninstall and reinstall.  First train to the plugin to update because it was a leased device.  Thanks again!

    Thanks MichelBParis!  I didn't see where he said to 12 items.  I downloaded the free DNG Converter last night and not had much luck.  It is not recognizing that I have all files in the folder at all.  Don't know what I'm doing wrong!

  • Select the records from the first n distinct values of column

    I need to write a query in plsql to select records for the first 3 values distinct from a single column (example below, ID) and all lines for the next 3 distinct values of column and so on until the end of the number of distinct values in a column.
    for example:
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10
    7 lmn 10
    .
    .
    .
    so now... (up to a few County)
    Result must be
    1 the application should result->
    Age of name ID
    1 abc 10
    1 def 20
    2 IA 10
    2 20 JKL
    2 mno 60
    3 10 pqr

    Query 2 should lead to->
    4 the RST 10
    4 10 TÜV
    5 vwx 10
    6 10 XYZ
    hij 6 10

    Query 3 should lead to->
    7 lmn 10
    .
    .
    9... ..
    so now...
    How to write a query for this inside a loop.

    Hello

    Thus, a panel will consist of the lowest id value, the 2nd lowest and the 3rd lower, reggardless of how many lines is involved. The next group will include the 4th lowest id, the 5th lowest and the 6th lowest. To do that, you must assign the numbers 1, 2, 3, 4, 5, 6,... for the rows in order by id, with all lines with the same id, getting the same number and without jumping all the numbers.
    This sounds like a job for the analytical DENSE_RANK function:

    WITH     got_grp_id     AS
    (
         SELECT     id, name, age
         ,     CEIL ( DENSE_RANK () OVER (ORDER BY id)
                   / 3
                   )          AS grp_id
         FROM     table_x
    )
    SELECT     id, name, age
    FROM     got_grp_id
    WHERE     id     = 1     -- or whatever number you want
    ;
    

    If you would care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
    See the FAQ forum {message identifier: = 9360002}

  • Delete in af:table always remove the first line when using ExecuteWithParams

    Hello world

    I got a page with master form and af:table two details related to the master. When I'm trying to remove a line in an af:table of detail, it always removes the first line, any line, I selected before. The table has a single = rowSelection and the line is properly visually selected. I remove the line using a "delete hyperlink" on each line, but I first have to select the line. Delete called a bond (or a method at the bean by removing the current line of the iterator, I tried both, none of them work)

    Links page has an ExecuteWithParams defining the correct ID to edit on the master of iterator and an InvokeExecuteWithParams the renderModel value. If I put the refresh condition zero and I hard-code an ID in the binding variable in the model, I am able to delete the selected line.

    In addition, I don't know if this information is useful, but if I set the iterator to PPR ChangeEventPolicy, when I select a line, there always select the first line.

    Any ideas what I could do wrong? Is this a bug?

    I use JDev 11.1.1.7

    Thank you

    Guillaume

    You can try creating a method in ApplicationModule for filter master records instead of executeWithParams?

    Ashish

  • make the first line of each paragraph "BOLD"

    Hi all

    I read this forum, but I can't really find the answer, I need.

    Here's my problem, we intend to automate the flow of text in our Organization, that's what I have to do

    -read the input from the story of a database

    -flow text into a text box in particular for example 4.5 cm wide

    -each paragraph will be had 2 new lines

    -Select the first line of each paragraph then putting in bold.

    in the above list, I can do everything except the first paragraph selection and putting in bold. I am looking for the selection of text I see there is a function called textframe.select?

    Can someone help me with this please?

    This severely reduced your options. (Which reminds me, you can specify a detail important like that from the beginning the next time.)

    The simple solution would be to apply your "BOLD" font (or better: a character style) in the first line of each paragraph by using the property of a paragraph .lines. UH customary ‑‑ link to the HTML version of the omitted OMV, it seems I'm not coming back as much as CS2... (Is there a CHM for it to http://www.jongware.com/idjshelp.html).

    This should work:

    App.Selection [0] .paragraphs [0]. Lines [0] .appliedCharacterStyle = "YourBoldCharStyle";

    ... With your cursor in the paragraph you want to change. Will adjust to meet your specific needs.

    There is a drawback of the simple method. Unless you use a special police who makes bold with the same width as her (quite rare) usually, the text will be redistributed after he applied. So there are one or more words in bold on the next line, so you must remove the tank style "BOLD" of those. But! At that time InDesign may determine that these non-bold words may go back on the first line!

    Well written code does not help, because it could be possible the same word oscillates backwards with each change between the first and the second line, each time to cheat... At * some * point you'll have to help the poor ID a bit; perhaps to fix this first line with No Break applied.

  • my printer has stopped printing. The issuance of documents in Quebec and he says the first line is printing, but it is not.

    my printer has stopped printing.  The issuance of documents in Quebec and he says the first line is printing, but it is not.

    Hello

    1. what version of Windows is installed on the computer?

    2. What is the brand and model of the printer?

    I suggest you to follow these steps and check if that helps:

    Method 1:
    Try to run the printer Troubleshooter and check that if it helps, here is the link:
    http://Windows.Microsoft.com/en-us/Windows7/open-the-printer-Troubleshooter

    Method 2:
    Try to run the below fixit and check if this may help:
    http://Windows.Microsoft.com/en-us/Windows7/why-cant-I-print

    It will be useful.

  • Scan of a file only works on the first line

    Hello

    I'm new to Labview (see 8.6) and I'm running on this problem.

    I use the Scan of a file to get a certain amount of information for the installation of test.txt.  The data of the file looks like this:

    AAA 1

    BBB 2

    REC 3

    I noticed that the Scan of the file works for only the first line.  Trying to get data that are not in the first line results in an error 85.

    Any ideas? Thank you

    It's all in what the scan of the file reads, and what is the next cgaracter in the file.

    Your first analysis of the file reads up to but NOT including the first newline in the file.

    The second read readings where the first reading was arrested and is expected to see 'B' as the next character, but sees the new line instead, and if the analysis fails. You must specify second reading formatted to await the return line.

    You can do this by making the FIRST character of the format string space, that will tell it to expect a number any of charaters 'white space '.

    Yo can indeed put a space at the beginning of the format string in your first analysis of the file and it will match with zero white space characters before you see the AAA. By doing this he also tolerate to see the spaces and tabs before your AAA or BBB identifiers.

    Rod.

  • sent letter drafts in hotmail, went back to send and only the first line of the text was visible, have been if the rest went, and how do I get that back

    typed a letter and drafts in hotmail, whent sent to retrieve to send and only got the first line of text back.

    Hotmail forums:

    http://www.windowslivehelp.com/forums.aspx?ProductID=1

    They will help you when repost you your question in the Forums above for Hotmail.

    See you soon

    Mick Murphy - Microsoft partner

  • HP all-in-one C310 printer prints the first line of text from the top of the page

    My printer worked fine for 2 years, then suddenly this week... the first printing line is missing! The first line of any text is printed only on the top of the book and at the bottom of the sheet, there is a gap between the last line of the text and the bottom of the paper. I.e. the printed text is not aligned to the Center vertically on the paper. I tried to shift from the printer and also restart the PC, but is always the same. She's also from any source print - Word or IE for example. I checked all the options of the printer and the settings of applications - everything seems OK and everything said A4 paper for example. What could be the cause of this please? I'm in Windows 8.

    No problem.  I'm happy to try to help.  I sent the steps to your Forums box.  Follow carefully and let me know how it goes.

    Good luck!

  • How to select and default hightlight the first line in a programmatic Table(ADF Table created based on a SortableModel) ADF.

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    We created a table ADF programming related to a SortableModel created programmatically to a bean.


    We need to select and highlight the first row in the table just after making it to retrieve data based on the first line.


    We tried the based on the following thread: How to call the bean support just after JSFF / page fragment loads? and a few other posts online, but it does not work very well.


    W has created a hidden text in the bottom of the JSF model as follows:


    < af:table varStatus = "rowStat" Summary = "table" value = "#{pageFlowScope.crudBean.dynamicTable.collectionModel} '"

    Rows = "#{pageFlowScope.crudBean.dynamicTable.collectionModel.RowCount} '"

    contentDelivery = 'immediate' var = 'row' rendered = 'true '.

    Binding = "#{backingBeanScope.crudBackingBean.tasksTable} '"

    selectionListener = "#{backingBeanScope.crudBackingBean.customListener} '"

    "rowSelection ="single"id ="t1"partialTriggers =": pt_gr2 "columnStretching =" column: clmn0 ">

    < af:forEach items = "#{pageFlowScope.crudBean.dynamicTable.columnNames}" var = 'name' varStatus 'vs' = > "

    < af:column sortable = "true" sortProperty rowHeader = "#{name}" = "no style" headerText = "#{pageFlowScope.crudBean.dynamicTable.columnLabel [name]}" "

    inlineStyle = "width: 100px;"  ID = "clmn$ {vs.index}" >

    < af:activeOutputText value = "#{row [name]}" id = "aot1" / >

    < / af:column >

    < / af:forEach >

    < / af:table >

    ....


    < af:outputText id = "hiddenOutputTextId" visible = "false" value = "#{backingBeanScope.crudBackingBean.afterPageLoad} '"

    Binding="#{backingBeanScope.crudBackingBean.hiddenOutputText}"/ >

    And we have added the code to the bean to support below:

    public String getAfterPageLoad() {}

    If (!.) {AdfFacesContext.getCurrentInstance () .isPostback ()}

    selectFirstRowInTasksTable();

    }

    Return afterPageLoad;

    }

    public void selectFirstRowInTasksTable() {}

    try {}

    RKS RowKeySet = new RowKeySetImpl();

    RowKeySet rksEmpty = new RowKeySetImpl();

    Model CollectionModel = tasksTable.getValue ((CollectionModel));

    ROWCOUNT int = model.getRowCount ();

    If (rowcount > 0) {}

    model.setRowIndex (0);

    Key of the object = model.getRowKey ();

    RKS. Add (Key);

    tasksTable.setSelectedRowKeys (rks);

    SelectionEvent selectEvent =

    new SelectionEvent (tasksTable.getSelectedRowKeys (), rks, tasksTable);

    selectEvent.queue ();

    customListener (selectEvent); / / to retrieve data

    AdfFacesContext.getCurrentInstance () .addPartialTarget (tasksTable);

    }

    } catch (Exception e) {}

    }

    }

    I think that () selectEvent.queue; should work even without calling the customerListener, but it is not working in all cases.

    What is the problem in my code?



    Have you tried to bind property of 'selectedRowKeys' to selection configuration / bean there?

    Something like:

    public RowKeySet getSelectedRKS() {
        if (rks == null) {
            // make first record as selected
            // create RowKeySet and assign it to rks variable(where rks is variable defined in bean with some scope higher than request scope)
        }
        return rks;
    }
    

    Dario

  • InDesign automatically formatting the first line of text in a textbox?

    Hello

    My question looks very easy, but I can't find an answer anywhere.

    I like automatically formats the first line of text in a text box with the style of good character.

    I tried already different ways like GREP or styles nested.

    But I never had the right solution.

    I hope you can help me!

    See you soon,.

    Raphael Tebarts

    Well, it's not entirely "automagical", maybe someone knows better as well.

    1. you create nested Style special Para with the line Style.

    2. with grep \A[^\r]+ find all paragraphs in your text boxes and apply your new paragraph Style.

    For more information, take a look here:

    http://GraphicDesign.StackExchange.com/questions/37272/grep-apply-character-style-until-ca distribution-back

  • How can I change the first line of the table to a header row if it contains PGF with tblHead tags

    So far, I have the following text in a JavaScript:

    If (tbl. FirstRowInTbl.FirstCellInRow.FirstPgf.PgfFmt.Name = "tblHead")

    {

    If (tbl. FirstRowInTbl.RowType = 1).

    1 is Constants.FV_ROW_BODY

    tbl. FirstRowInTbl.RowType = 0;

    0 is Constants.FV_ROW_HEADING

    on the other

    continue;

    }

    on the other

    continue;

    It does not work. I'm not comfortable with tbl. FirstRowInTbl.FirstCellInRow.FirstPgf.PgfFmt.Name.

    It is clearly wrong. How I would I want to determine the tag of the first paragraph of the first line?

    Any help is very appreciated!

    Thank you

    Ruth

    Ruth, here is a function that converts the body lines to the header of a table lines. Please let me know if you have any questions or comments. -Rick

    #target framemaker
    
    var doc = app.ActiveDoc;
    
    // Set a variable for the selected table.
    var tbl = doc.SelectedTbl;
    
    // Convert the first body row to a heading row.
    bodyToHeadingRow (tbl, 1, doc);
    
    function bodyToHeadingRow (tbl, num, doc) {
    
        var row = 0;
    
        // Select the top "num" rows in the table.
        tbl.MakeTblSelection (0, num - 1, 0, tbl.TblNumCols - 1);
        // Push the current clipboard contents and cut the selected rows.
        PushClipboard ();
        doc.Cut (Constants.FF_CUT_TBL_CELLS);
        // Add "num" number of heading rows to the table.
        row = tbl.FirstRowInTbl;
        row.AddRows (Constants.FV_Heading, num);
        // Select the new heading rows.
        tbl.MakeTblSelection (0, num - 1, 0, tbl.TblNumCols - 1);
        // Paste the rows from the clipboard into the new heading rows.
        doc.Paste (Constants.FF_REPLACE_CELLS);
        // Restore the clipboard contents.
        PopClipboard();
    
    }
    
  • Update of the Page choose the first line only

    Hello

    I created SearchPG and from there I click on the UpdatePencil and regardless of which line is clicked, I always get the first line of the table of search results.

    Please notify.

    Thank you!

    Hey,.

    Please get your hands on the original Version and run the query in providing parameters of the basic page.

    If you use EO, implement the code in AM or you can add the code to the CO of the UpdatePage.

    I hope this helps.

    Thank you
    Rakesh

Maybe you are looking for