Report without the first record using JasperReports

Hi everyone,
I�m using JasperReports127 but the first record is not being showed...
I really don�t know why... Does someone had the same problem?!
I follow this tutorial:
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/reports.html
Gustavo Callou

I forgot to say that what ir really interesting is that in the iReport Aplication the report works fine... but in the jsc not...
my setor.jrxml is bellow:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
          name="classic"
          columnCount="1"
          printOrder="Vertical"
          orientation="Portrait"
          pageWidth="595"
          pageHeight="842"
          columnWidth="535"
          columnSpacing="0"
          leftMargin="30"
          rightMargin="30"
          topMargin="20"
          bottomMargin="20"
          whenNoDataType="NoPages"
          isTitleNewPage="false"
          isSummaryNewPage="false">
     <property name="ireport.scriptlethandling" value="0" />
     <property name="ireport.encoding" value="UTF-8" />
     <import value="java.util.*" />
     <import value="net.sf.jasperreports.engine.*" />
     <import value="net.sf.jasperreports.engine.data.*" />
     <queryString><![CDATA[select *
from tb_setor
where tb_setor.incodigosetor > '0'
order by tb_setor.vanome
]]></queryString>
     <field name="INCODIGOSETOR" class="java.math.BigDecimal"/>
     <field name="VANOME" class="java.lang.String"/>
     <field name="VARAMAL" class="java.lang.String"/>
          <background>
               <band height="0" isSplitAllowed="true" >
               </band>
          </background>
          <title>
               <band height="50" isSplitAllowed="true" >
                    <staticText>
                         <reportElement
                              x="61"
                              y="5"
                              width="412"
                              height="40"
                              key="staticText"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement textAlignment="Center">
                              <font size="28" isBold="true"/>
                         </textElement>
                    <text><![CDATA[Setores]]></text>
                    </staticText>
                    <line direction="TopDown">
                         <reportElement
                              x="0"
                              y="48"
                              width="534"
                              height="0"
                              forecolor="#000000"
                              key="line"
                              positionType="FixRelativeToBottom"/>
                         <graphicElement stretchType="NoStretch" pen="2Point"/>
                    </line>
                    <line direction="TopDown">
                         <reportElement
                              x="0"
                              y="3"
                              width="534"
                              height="0"
                              forecolor="#000000"
                              key="line"/>
                         <graphicElement stretchType="NoStretch" pen="2Point"/>
                    </line>
               </band>
          </title>
          <pageHeader>
               <band height="9" isSplitAllowed="true" >
               </band>
          </pageHeader>
          <columnHeader>
               <band height="20" isSplitAllowed="true" >
                    <rectangle radius="0" >
                         <reportElement
                              mode="Opaque"
                              x="1"
                              y="1"
                              width="534"
                              height="17"
                              forecolor="#000000"
                              backcolor="#999999"
                              key="element-22"/>
                         <graphicElement stretchType="NoStretch" pen="Thin"/>
                    </rectangle>
                    <staticText>
                         <reportElement
                              x="0"
                              y="1"
                              width="267"
                              height="16"
                              forecolor="#FFFFFF"
                              key="element-90"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement>
                              <font fontName="" size="12"/>
                         </textElement>
                    <text><![CDATA[Setor]]></text>
                    </staticText>
                    <staticText>
                         <reportElement
                              x="267"
                              y="1"
                              width="267"
                              height="16"
                              forecolor="#FFFFFF"
                              key="element-90"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement>
                              <font fontName="" size="12"/>
                         </textElement>
                    <text><![CDATA[Ramal]]></text>
                    </staticText>
               </band>
          </columnHeader>
          <detail>
               <band height="19" isSplitAllowed="true" >
                    <line direction="TopDown">
                         <reportElement
                              x="0"
                              y="17"
                              width="535"
                              height="0"
                              forecolor="#808080"
                              key="line"
                              positionType="FixRelativeToBottom"/>
                         <graphicElement stretchType="NoStretch" pen="Thin"/>
                    </line>
                    <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
                         <reportElement
                              x="0"
                              y="1"
                              width="267"
                              height="15"
                              key="textField"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement>
                              <font fontName="Times-Roman" size="12"/>
                         </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{VANOME}]]></textFieldExpression>
                    </textField>
                    <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
                         <reportElement
                              x="267"
                              y="1"
                              width="267"
                              height="15"
                              key="textField"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement>
                              <font fontName="Times-Roman" size="12"/>
                         </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{VARAMAL}]]></textFieldExpression>
                    </textField>
               </band>
          </detail>
          <columnFooter>
               <band height="0" isSplitAllowed="true" >
               </band>
          </columnFooter>
          <pageFooter>
               <band height="27" isSplitAllowed="true" >
                    <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
                         <reportElement
                              x="325"
                              y="4"
                              width="170"
                              height="19"
                              key="textField"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement textAlignment="Right">
                              <font fontName="Helvetica" size="10"/>
                         </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
                    </textField>
                    <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" >
                         <reportElement
                              x="499"
                              y="4"
                              width="36"
                              height="19"
                              forecolor="#000000"
                              backcolor="#FFFFFF"
                              key="textField"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">
                              <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" />
                         </textElement>
                    <textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
                    </textField>
                    <line direction="TopDown">
                         <reportElement
                              x="0"
                              y="1"
                              width="535"
                              height="0"
                              forecolor="#000000"
                              key="line"/>
                         <graphicElement stretchType="NoStretch" pen="2Point"/>
                    </line>
                    <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
                         <reportElement
                              x="1"
                              y="6"
                              width="209"
                              height="19"
                              key="textField"/>
                         <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                         <textElement>
                              <font fontName="Times-Roman" size="10"/>
                         </textElement>
                    <textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
                    </textField>
               </band>
          </pageFooter>
          <summary>
               <band height="0" isSplitAllowed="true" >
               </band>
          </summary>
</jasperReport>

Similar Messages

  • Unable to search for first record using the Preview tree

    Post Author: TheBig1980s
    CA Forum: General
    Hello:
    Users are unable to search for the first record in the Preview tab's tree.  The reason for this is because the first record is within the first page header of the report.  My guess is that, by design, Crystal takes the end user to whatever the first instance of the record iseven if that first record is in a page header.  That's not "good".  I want the user to be taken to the first record within the details of the reportnot within the page header.
    I have suppressed the page header to not print on the first record by using OnFirstRecord.  But, I still get the same issue where end users cannot select the first record in the tree without being taken to the page header.  Very strange.
    Can anybody think of any other ideas?
    Thanks!
    TheBig1980s

    Thank you Dave Merchant and try67 for your responses. As per my previous post, I contacted the company re the catalogue and they have responded favourably. I'll include their response because it gives the reason for the search failure as document compression which you might find interesting. I'll await their new catalogue and see if they have fixed the problem.
    Company response:
    Thank you very much for your input.  And yes, you are correct, the compression we used for the current catalogue's PDF format does strip out text included in the catalogue.  We used the compression settings we did with the intention of minimising download time, however I take your point about including text for search purposes (which I also utilise when I'm scanning through PDFs).
    We will actually be posting out our new catalogue next week and we'll release the new PDF version on the website at the same time.  I've asked our graphic designer to ensure that the PDF we use for the new catalogue includes searchable text.

  • How do I blank my BI Pub report parameter from returning the first record when output to HTML?

    Hi all.
    I have a report that has several parameters A, B, C D.
    I include these at the head of the rtf report.
    I run the report WITHOUT entering anything for parameters A & B.
    When the report generates (returning all the expected correct records), it enters into parameter fields A & B at the top of the report the first records’ A & B fields when they should be blank.
    IS there something I need to do in the rtf form field Help text along with the field name?
    ThanksForLoooking..
    Malc

    within the rtf of the report, within the form-field-help-text, this should work..
    <?xdofx:decode(<parameter name>,'','',<parameter name>)?>
    if the parameter is left blank, then don't put anything in the rtf field, otherwise put in anything that is selected in the parameter.
    or this..
    <?xdofx:if <parameter name>='' then 'All Params Included' else <parameter name> end if?>
    ..yet, when the parameter is left blank, the parameter field in the report generated is populated with whatever is in the first line of the parameter in the report.
    I also can't find anything in the old rdf that is causing this either.  Help!

  • HT5002 I used Inkscape on Linux before moved to Mac. Now I am trying to install it using MacPorts, but libpixman has some problems that has been reported out there. Does any one know how to fix it without the need to use other way than MacPorts?

    I used Inkscape on Linux before moved to Mac. Now I am trying to install it
    using MacPorts, but libpixman has some problems that has been reported out there.
    Does any one know how to fix it without the need to use other way than MacPorts?

    Start with this comprehensive troubleshooting article:
    https://discussions.apple.com/docs/DOC-3521
    Look at this one for possible solutions:
    https://discussions.apple.com/docs/DOC-3353
    Ciao.

  • Master-Detail only shows the first record of the Master's data

    I have an ADF Master Table, Detail table. I use ExcuteWithParams on the Master Table. When executed from a button (Button has partial submit = true for button, Master Table has PartialTrigger on button, and Detail table has PartialTrigger on Master table and button), it works fine. However, I want to pass the parameters in pageFlowScope variables, and have the ExecuteWithParams invoked upon page load. When I try to do this, the Detail table only shows the first record of the Master's data, no mater what row is clicked on the Master table.
    Master table now has no PartialTrigger, and Detail table has PartialTrigger on Master table. In my pageDef, I used an invoke action as follows:
    <invokeAction Binds="ExecuteWithParams" id="invokeExecuteWithParams"
    Refresh="always"/>
    What am I missing? I am using verion 11.1.1.3. Any help would be much appreciated.
    Thanks,
    Jessica

    Yes, it works when I drag the data control as a master detail without filtering any data. I want the user to be able to set search criteria to filter the data in the master table (For example, only pull back data with a transaction date between :startdate and :enddate). I can get it to work if I execute from an executewithparams button on the page, but not if I want to invoke the executewithparams upon page load with the parameter set by pageflowscope variables.
    Thank you for responding.
    Jessica

  • Display only the first record

    I have report in BEx where we want to find the first time a customer ordered Quantity of more than 500 in a data range (For Ex: From April 10 to April 30). In a particluar date range the customer may order more than once (Qty > 500). The catch is we want display only one first time he ordered qty > 500.
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
              4/22/2005        12,290 CA
              4/23/2005        4,826 CA
              4/26/2005        6,397 CA
              4/27/2005        1,538 CA
              4/28/2005        4,849 CA
    XYZ         4/25/2005        2,000 CA
              4/26/2005        12,000 CA
              4/27/2005        4,500 CA
              4/28/2005        6,300 CA
    In the output report we want to display the first record for each customer as:
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
    XYZ         4/25/2005        2,000 CA
    Your help is really appreciated. Thanks.

    jayant,
    i think, you could use your date as a condition to filter by in your report... try looking that the properties of your KF and, under Calculations, set the 'Calculate Result as...' to the first value only.
    hope this helps - don't forget to give out points. =)
    ryan.
    ps. i've tried this, and it sort of works - just need a bit more of tweaking around. =)
    Message was edited by: Ryan Kristoffer Tan

  • How to take a value of the first record/occurrence and the last record?

    Hi experts
    Can anyone help me to tell me:
    How to make IP can take a value of the first record/occurrence and the last record in CSV file?
    I need to take the first and last to put StarTime of first record y StopTime of last record in the target file
    This is my Original CSV File
    20110820,220DNE0220,140.13 ,0.000 ,E01,0
    20110820,240FGC4280,103.80 ,0.000 ,E01,0
    20110821,220DNE0220,142.58 ,0.000 ,E01,0
    20110821,240FGC4280,88.70 ,0.000 ,E01,0
    20110822,220DNE0220,151.92 ,0.000 ,E01,0
    20110822,240FGC4280,91.47 ,0.000 ,E01,0
    Where:
    The firts field is date.
    I require it so my Target File
    20110820,20110822,140.13 ,0.000 ,E01,0
    20110820,20110822,103.80 ,0.000 ,E01,0
    20110820,20110822,142.58 ,0.000 ,E01,0
    20110820,20110822,88.70 ,0.000 ,E01,0
    20110820,20110822,151.92 ,0.000 ,E01,0
    20110820,20110822,91.47 ,0.000 ,E01,0
    Thaks..

    Hi lizcam,
    A. Use FCC at sender side, it will convert CSV to XML like this
    Input XML
    <documentName>
    <recordset>
    <record>
      <Time>20110820</Time>
      <ID>220DNE0220</ID>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    </documentName>
    Create a target DT like this
    Output XML
    <recordset>
    <record>
      <StartTime>20110820</StartTime>
      <EndTime>20110822</EndTime>
      <Quan>140.13</Quan>
      <Volume>0.000</Volume>
      <Auc>E01</Auc>
      <No>0</No>
    </record>
    </recordset>
    In MM,
    1.Time -> CopyValue[0] -> StartTime
    2.Time -> below UDF -> EndTime
    3.Quan -> Quan
    4.Volume -> Volume
    5.Auc -> Auc
    6.No -> No
    UDF u2013 Execution type u2013 All values of Queue
    public void getLastTimeValue(String[] inputEndTime, ResultList result, Container container) throws StreamTransformationException{
    result.addValue(inputEndTime[inputEndTime.length-1]);
    B. At receiver use again FCC to convert XML to CSV.
    FYI. If you want to optimize more, you can use
    1.globalContainer concept OR
    2.u201CAttributes and Methodsu201D, declare are String. Store the EndTime using one UDF and write another UDF to retrieve it.
    Regards,
    Raghu_Vamsee

  • Opening a form and displaying the first record

    Any ideas on what the easiest solution would be to show the first record on a form when the form is opened? I've tried some of the ideas discussed in the FAQ section, but without success!!
    Thanks........GD

    Greg,
    Sorry, but there is no other solutions other than those described in the FAQ. I know that it is not very "user-friendly", but should work.
    Also if you search the forum's archive there were some concrete examples posted.
    Thanks,
    Dmitry

  • DB Adapter: Polling For New Records returns the First record multiple Times

    I Polling for New or Chnaged Records against DB2 on iSeries. The DB Adapter returns the first record from the Table multiple Times. If the Table has 5 records it displays the first record 5 times. I am using BPEL 10.1.3.1 Can anyone help me with this.

    Hi there,
    please check out the DBAdapter trouble-shooting guide:
    http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/app_trblshoot.htm#CIHFEHFA
    I am copying an entry from there into here:
    A.1.21 Some Queried Rows Appear Twice or Not at All in the Query Result
    Problem
    When you execute a query, you may get the correct number of rows, but some rows appear multiple times and others do not appear at all.
    This behavior is typically because the primary key is configured incorrectly. If the database adapter reads two different rows that it thinks are the same (for example, the same primary key), then it writes both rows into the same instance and the first row's values are overwritten by the second row's values.
    Solution
    Open Application Sources > TopLink > TopLink Mappings. In the Structure window, double-click PHONES. On the first page, you should see Primary Keys. Make sure that the correct columns are selected to make a unique constraint.
    Save and then edit the database partner link.
    Click Next to the end, and then click Finish and Close.
    Open your toplink_mappings.xml file. For the PHONES descriptor, you should see something like this:
    <primary-key-fields>
    <field>PHONES.ID1</field>
    <field>PHONES.ID2</field>
    </primary-key-fields>
    Thanks
    Steve

  • How to return to the first record of a multiple row cursor (Forms 6i)

    Hi all,
    I had a bit of a search through here, but couldn't quite find the answer I'm after.
    I have a multiple row cursor, which I feed into a multi-row block in Forms 6i. I have the following code:
    OPEN CURSOR;
    LOOP
       FETCH CURSOR INTO :FIELD1, :FIELD2, :FIELD3, :FIELD4;
       ... do other code not related with cursor
       EXIT WHEN CURSOR%NOTFOUND;
       NEXT_RECORD;
    END LOOP;Now, I use the Forms built-in NEXT_RECORD to move down through the records on the form and fill in each row from the db. However, once the block loads (this works correctly), the current item (ie where the typing cursor is left) is on the last record.
    Obviously, I need the current item (after loading) to be on the first record. I tried using the Forms built-in FIRST_RECORD after the END LOOP command, but that gives me an ORA-06511 error (An attempt was made to open a cursor that was already open).
    Does anyone know how I might be able to return to the first record of the block correctly?
    Thanks in Advance,
    Chris.

    Ok, I feel like a bit of a dolt.
    I found that all cursors had to be closed before navigating back to the first record.
    Case closed! :)

  • Going to the next record using Iterators. Please HELP

    No offence meant for asking again as this is URGENT.
    I am unable to go to the next record.
    I need to go to the next record using the RowsetIteratorTag.
    But am getting the null pointer exception.
    Please can anyone tell me the way to go to the next record.
    I AM USING THE NEXT(),BUT STILL NO LUCK
    public class CheckDetailRowsIterate extends TagSupport
         public int doStartTag() throws JspException
           Row currentRow = null;
           Row nextRow = null;
           String m_CmpyCode;
           // Find the current row and get Data out of it.
           RowsetIterateTag detailIterator = (RowsetIterateTag)TagSupport.findAncestorWithClass(this, RowsetIterateTag.class);
           if (detailIterator != null)
              currentRow = detailIterator.getRow();
           else
               // No row iterator
               log.logDebug(ClassName,"","No CURRENT ROW Found : ");
           if(currentRow != null)
             String[] attrNames = currentRow.getAttributeNames();
             Object[] obj = currentRow.getAttributeValues();
             // Get the attribute Values
             m_CmpyCode = obj[currentRow.getAttributeIndexOf("CmpyCode")].toString();
            /* Now,move to the next Row.GIVES NULL POINTER EXCEPTION.
            RowSet rowSet = new IT().getRowSet();
            nextRow = rowSet.next();
            m_CmpyCode = obj[nextRow.getAttributeIndexOf("CmpyCode")].toString();
            log.logDebug(ClassName,"","NEXT ROW Values ARE "     + m_CmpyCode );
            rowSet = null;
            return Tag.SKIP_BODY;
         public class IT extends RowsetIterateTag
                 RowSet getRowSet()
                      return rs;
    }  // End class.

    You cannot look for a duplicate record situation using a timer. When you issue the Raise Form_trigger_failure from the when-timer-expired trigger, all it does is stops that trigger. The when-validate trigger has already run and completed with success, before the when-timer-expired trigger even started.
    You must do the checking and raise form_trigger_failure at the same time from the When-validate-record trigger.
    In fact, you don't even need to Post; first. In the WVR trigger, just do this:
    If :System.Record_Status = 'INSERT', then do the select.
    Then, if v_counter >= 1, issue the message and Raise Form_Trigger_Failure;

  • Getting the first record

    I have a table containing infor about employees promotion details.Problem is that the table was so badly designed that the only way for me to know the first promotion that an employee got in that year was the way it was inserted.Hence below for Manohar ,91 was the first promotion in the year 2001 and
    for Sanohar it is 81.
    Wondering is there sql query throught which I can get hold of the first record that was inserted.
    YEAR____EMPCODE_____NAME_______POSITION
    2001______02_________Manohar________91
    2001______02_________Manohar________01
    2001______02_________Manohar________07
    2001______03_________Sasohar________81
    2001______03_________Sasohar________84
    2001______03_________Sasohar________87

    this migth be of help:
    SQL> select rowid, year, empcode, name, position
      2    from employees;
    ROWID              YEAR EM NAME       PO
    AAD8PAAAJAAAAzwAAA 2001 02 Manohar    91
    AAD8PAAAJAAAAzwAAB 2001 02 Manohar    01
    AAD8PAAAJAAAAzwAAC 2001 02 Manohar    07
    AAD8PAAAJAAAAzwAAD 2001 03 Sasohar    81
    AAD8PAAAJAAAAzwAAE 2001 03 Sasohar    84
    AAD8PAAAJAAAAzwAAF 2001 03 Sasohar    87
    6 rows selected.
    Elapsed: 00:00:00.00
    SQL> select emp.year, emp.empcode, emp.name, emp.position,
      2         emp.promotion, rowid
      3    from (select year, empcode, name, position,
      4                 rank() over (partition by empcode order by rowid) promotion
      5            from employees) emp
      6  /
    YEAR EM NAME       PO  PROMOTION ROWID
    2001 02 Manohar    91          1 AAD8PAAAJAAAAzwAAA
    2001 02 Manohar    01          2 AAD8PAAAJAAAAzwAAB
    2001 02 Manohar    07          3 AAD8PAAAJAAAAzwAAC
    2001 03 Sasohar    81          1 AAD8PAAAJAAAAzwAAD
    2001 03 Sasohar    84          2 AAD8PAAAJAAAAzwAAE
    2001 03 Sasohar    87          3 AAD8PAAAJAAAAzwAAF
    6 rows selected.
    Elapsed: 00:00:00.00
    SQL> note: you can use the rowid to identify which row has been inserted first. if this is something that you want to get the first row that was inserted.

  • How to select the first record?

    Hi,
    Could anyone tell me how to select the first record of every
    group?
    ex, I want to find out every customer their first purcaseDate.
    CustomerID PurcaseDate Region
    A00000001 2001/01/01 AA
    A00000001 2001/02/02 AA
    A00000002 2001/03/01 AC
    A00000002 2001/05/07 AC
    A00000003 2001/03/05 DD
    result:
    A00000001 2001/01/01 AA
    A00000002 2001/03/01 AC
    A00000003 2001/03/05 DD
    Thanks

    Vincent,
    You could do it as Carl suggested, with a couple of
    corrections.  You would need to include the CustomNo column in
    the order by clause of your cursor.  You would also need to add
    a where clause to your update statement, otherwise everywhere
    Region in the table would be updated with the same value of the
    last CustomNo in the cursor, regardless of the CustomNo in the
    table.  See corrected code below:
    DECLARE
      CURSOR     cust
      IS
      SELECT     DISTINCT CustomNo, Region, Purchase_Date
      FROM       my_table
      ORDER BY   CustomNo, Purchase_Date, Region;
      c_customer VARCHAR2 (9) := '...';
      c_region   VARCHAR2 (2) := '..';
      cntr       NUMBER := 0;
    BEGIN
      FOR x IN cust
      LOOP
        IF x.CustomNo != c_customer
        THEN
          c_customer := x.CustomNo;
          c_region := x.Region;
        ELSE
          UPDATE my_table
          SET    Region = c_region
          WHERE  CustomNo = c_customer;
          cntr := cntr + 1;
          IF cntr = 25
          THEN
            COMMIT;
            cntr := 0;
          END IF;
        END IF;
      END LOOP;
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN 
        NULL;
    END;
    Another option is that you could just use one update statement,
    like this:
    UPDATE my_table a
    SET    Region =
           (SELECT DISTINCT Region
            FROM   my_table b
            WHERE  (CustomNo, Purchase_Date) IN
                   (SELECT   CustomNo, MIN (Purchase_Date)
                    FROM     my_table
                    GROUP BY CustomNo)
            AND    a.CustomNo = b.CustomNo)
    Barbara

  • How to populate only the first record by default when the page opens?

    Dear Members,
    I am using OAF R12 and my requirement is as follows:-
    When the user opens the custom OAF R12 page, I just want to query the first record from the underlying VO.
    For example, If the table has 10 rows, I just want to query the first row as soon as the page opens.
    I have written the below code:-
    Process Request Method of the CO:-_
    am.invokeMethod("initHeaders");
    Code in AM_
    public void initHeaders()
    HeadersVOImpl hVO = getHeadersVO1();
    hVO.initQueryHeaders();
    Code in VO_
    public void initQueryHeaders()
    executeQuery();
    As it is very clear that with the above code all the records will be queried. I have to add something before the executeQuery() method in the VO to just query the first record.
    Can any one please help me by guiding me what I should add before the executeQuery() method in the VO?
    Many thanks in advance.
    Regards,
    R4S.

    Hello Gyan,
    Many thanks for your reply.
    The below line in your code is throwing incompatible type error:
    OARow row = vo.first();
    Can you please help me.
    Regards,
    R4S

  • After upgrading from Mavericks to Yosemite I can no longer find in Mail the icon (looks like the Add To Contacts icon without the   mark) I used to press in order to obtain an e-mail address from my contact list. What procedure should I use now in or

    After yesterday upgrading from Mavericks to Yosemite I can no longer find in Mail the icon (looks like the Add To Contacts icon without the + mark) I used to press in order to obtain an e-mail address from my contact list. What procedure should I use now in order to quickly add an address to an e-mail that I wish to send?
    Bob

    On the right of the To: field you will see a circled plus sign:
    Click it.

Maybe you are looking for

  • Unable to create GlassFish server on Luna

    Hi all, I'm experiencing the same problem than here https://www.eclipse.org/forums/index.php/t/821156/, but according to the comments that was already fixed. This is what I'm trying: Install the Glassfish Tools from the Marketplace In the Servers vie

  • How to link asset with purchase order and PO Item.

    Hello,        I have to generate a report which contains columns Asset No , po no(ebeln) ,PO Item(ebelp),Material no etc My query is how to link asset with purchase order and      PO Item. I am selecting asset and po no. from anla  but how to get po

  • IU Elimination Difference Subassignments (Business Area and Profit Center)

    Hi experts, it's my second tread in the forum and is in one day, I'm expired. <br> <br> Let's clarify the situation. <br> <br> At the past I'm using the parameters settings of IU Eliminination Difference Subassigments with fixed values, now, with our

  • CRM_CON_COM_BADI for IPC

    Hello Experts, Does anybody know how to make sure that CRM_CON_COM_BADI will always get called upon saving of the document?  From my testing, sometimes it does, sometimes it doesn't.  I realized that the BADI will get called when changing/adding line

  • I can't delete photos from my iPhone (no trashcan visible). How can I delete before I activate my new iPhone.

    It seems that once I backed up my iPhone and iPad to the cloud, whenever I did subsequent back-ups or syncs, it transferred all the photos to my iPhone. Now I can't delete them (no trashcan visible). I don't want all 430+ photos synced when I activat