Searching 2 years either side of a date field?

Hi
In my query I would like the search to be able to search 2 years either side of a specified search date in my interactive report
select
ROWID,
ID,
COLUMN1,
COLUMN2,
TO_CHAR(INDDOB, 'YYYY') AS NEWYEAR
from TABLENAME
ORDER BY INDDOB asc
The interactive report is also using custom Javascript to offer an autocomplete search as per this thread For VC - Using multiple Autocomplete on a page?
So I am unsure how this would work by allowing the date results to include 2 years either side of the chosen date?

Mike many thanks for this
INDDOB is a date field in the DB and the item name is :YEARD
Using the following WHERE clause and a default vale of 1930 in the :YEARD item name is returning the correct result i.e. 1930 plus records from 1928,1929,1931 and 1932
select
ROWID,
ID,
INDSUB,
INDDOD,
INDREG,
INDENT,
INDDOD,
INITCAP(INDSNAME) indsname,
INITCAP(INDFNAME) INDFNAME,
TO_CHAR(INDDOD, 'YYYY') AS NEWYEAR,
DELDOC from   RAMBO.TABLENAME
WHERE to_char(INDDOD,'YYYY') between :YEARD -2 and :YEARD +2
ORDER BY INDDOD asc
The problem is however when I try and change the search value in :YEARD from the default 1930 to for example 1950 (which is also in the db)
When doing this it brings back no results? Could it be something to do with the associated code below which provides an autocomplete feature and search of the IA report as you type in the field name.
In the :YEARD item under label and HTML table Cell attributes has the following
onkeydown="if($f_Enter(event)){srch3($v('YEARD')); return false;}"
and under the list of values in the definition for :YEARD is
select distinct TO_CHAR(INDDOD, 'YYYY') from RAMBO.TABLENAME order by 1
Also under page and Javascript is the following
function srch2(pItem, pColumn) {  
   $.post('wwv_flow.show',
          {"p_request"          : 'APXWGT',
          "p_widget_action"     : 'FILTER',
          "p_widget_action_mod" : 'ADD',
          "p_widget_mod"        : 'ACTION',
          "p_widget_name"       : 'worksheet',
          "p_flow_id"           : $v('pFlowId'),
          "p_flow_step_id"      : $v('pFlowStepId'),
          "p_instance"          : $v('pInstance'),
          "x01"                 : $v('apexir_WORKSHEET_ID'),
          "x02"                 : $v('apexir_REPORT_ID'),
          "x03"                 : pColumn,
          "f01"                 : ['COLUMN', pColumn, '=', $v(pItem), null, 'minutes']
         function(data){
            //when the filter has been successfully applied the report has to be refreshed
            if(data=="true"){
               gReport.pull();
   //clear the item
   $s(pItem,'');
$(document).ready(function(){
   //hide IR toolbar
   $('#apexir_TOOLBAR').hide();
   $('#P4_AC').bind("result", function(){   
      //on selecting a value then fire the search function
      srch2(this, 'INDSNAME');
   // ac item P4_AC2
   $('#P4_AC2').bind("result", function(){   
      srch2(this, 'INDFNAME');
   // ac item YEARD
   $('#YEARD').bind("result", function(){
      srch2(this, 'NEWYEAR');
// ac item REG
   $('#REG').bind("result", function(){
      srch2(this, 'INDREG');
// ac item ENTNO
   $('#ENTNO').bind("result", function(){
      srch2(this, 'INDENT');

Similar Messages

  • Jdev 10.1.13 EA1 - search form (BC + ADF faces) with date field

    Did anyone tried to make a simple search form with BC,( just draging view form control palette to faces page?)
    Because when i did it and tried to search by one date field (for example orderDate) i got exception:
    oracle.adfinternal.view.faces.convert.ConvertException: Could not convert instance:Wed Sep 07 00:00:00 CEST 2005 of type:class java.util.Date into type:class java.lang.String
    Is it a bug?
    I tried to use converDateTime component but it haven't fixed the problem.
    Bart.

    Hi,
    Business Components doesn't perform type conversion. This is the problem I see. Basicaly the expected format is String
    Could not convert instance:Wed Sep 07 00:00:00 CEST 2005 of type:class java.util.Date into type:class java.lang.String
    Is you date field really a date field ?
    Frank

  • Search via date field

    Hello All,
    I have to search record from  the DB via date field in such a way that
    suppose this mounth is aug. then i have to search all record created on aug
    no matter in which  year it was created.
    Thanks

    Hi,
    Check the code
    DATA: T_flight TYPE TABLE OF SFLIGHT,
          DATE TYPE SY-DATUM,
          DATE_TEMP(2) TYPE C,
          DATE_CHECK(8) type c.
    DATE = SY-DATUM.
    DATE_TEMP = DATE+4(2).
    concatenate '____' DATE_TEMP '__' INTO DATE_CHECK.  
                     "( 1st string consist of 4 underscore
                     " and 3rd string has 2 underscore,   
                     "  as _ is the escape char for single char in open SQL )
    SELECT *
      FROM SFLIGHT
      INTO TABLE t_FLIGHT
    WHERE FLDATE like DATE_CHECK.
    Regards,
    anirban

  • Extract Year (only) from Date Field and Display in Text Field

    I need to extract the year from a user entered date field and display the year in a text field. Can someone help me with the correct script to do this?

    Hi,
    that's quite easy to realize with FormCalc.
    In you date fields exit event add the following code:
    textField1 = Num2Date( Date2Num($.formattedValue, "MM/DD/YYYY"), "YYYY")
    Note: This sample assumes that your date field formats the date with "MM/DD/YYYY". You may have to change the pattern to make it work at your end.

  • Combined more Data Fields from different segments in single report

    Hi all,
    i want to combined report from more then one segment(like 2 fields from Sales & Distribution & one Field from Inventory) then what should i do so far,
    should i create cubes in respective segment,
    either i create that but when i add it into Select item in that after selection of a field all of others segment disabled.

    Hi
    By far the simplest method would be to concatenate the two fields in a calculation like this: FIELDA || FIELDB
    Should you want spaces between them then do this: FIELDA || ' ' || FIELDB
    If you want a dash and spaces either side you do this: FIELDA || ' - ' || FIELDB
    Does this help?
    Best wishes
    Michael

  • How to initialize SAP calendar of a date field

    Hello,
    I have a date field in Adobe.
    I need to initialize the SAP calendar(but not the field) that is shown if one chooses the calendar.
    The SAP calendar shows always the current month and date. Is it possible to initialize the SAP calendar with some other month but current month and how?
    Thanks.  
    Kind regards,
    Amel

    I am sorry again, I don´t get exactly what your problem is. are you sure it is related to Adobe forms?
    If you want to start the pick up of the date in adobe form from a particular date, first fill in such a date into the field and next open the field and the help calendar will be displayed with the month and year you used in the date field value. You cannot change anything in this adobe form component. You can only attach some messages/ actions to the field that will tell the user that such a date is not acceltable and why (message box: "only saturdays possible, my friend" etc.) and maybe clear the field value or set some default value and make the user pick up the date again.
    Nothing more can be done in my humble opinion, regards Otto

  • Search Page by date field not showing up results

    Hi,
    I am using Jdev 11g and new to adf.
    My applciation needs a search page based on a date field.
    I created a viewcriteria for the object which expects a date field from the user.( the bind variable is of type Date)
    After this i dragged the viewcriteria as af:query (panel with table) on the jspx page.
    Now when i run the application, that is when i enter the date (calendar autogenerated by query component),
    it does not show up any results.
    My date field in the database has a timestamp attached to it, somewhere i read that the timestamp may be causing the problem.
    But i have not found any solution for this one.
    This looks very basic to me, i am sure i am missing soemthing important.
    Besides i even tried the approach of programmaticlly populating the Viewobject(by not using the any query component),
    i can see the Viewobject being populated in the logs( the row count) but on the display page, no rows are shown.
    I am sure i am doing something wrong for this one.
          AppModuleImpl am = this.getAm();
           ViewObject submittalVO = am.findViewObject("AcrSubmittallogView1");
           System.out.println("after getting VO");
           String subDate = this.getSubDate().getValue().toString();
           String query = " to_char(SubmitDtTm,'mm/dd/yyyy') = '"+subDate+"'";
           submittalVO.setWhereClause(query);
           System.out.println("QUERY>>>> "+submittalVO.getQuery());
           submittalVO.executeQuery();
          System.out.println("after executing query "+submittalVO.getRowCount());
           this.setRenderLogTable(true);But i actually want to use the built in query component instead of programmatically doing it.
    Can someone please guide me further.
    Any help will be grt.
    Thanks in advance
    ash
    Edited by: user1175461 on Jul 15, 2010 1:18 PM

    Still not working for me either, here's exactly what I'm doing.
    My query is as follows:
    SELECT
    RO.repair_line_id,
    RO.repair_number,
    SR.customer_po_number, segment1,
    trunc(RO.creation_date) as creation_date,
    I've created a Bind Variable for the creation_date as follows:
    <Variable
    Name="createDate"
    Kind="viewcriteria"
    Type="oracle.jbo.domain.Date"/>
    Which is linked to a view criteria:
    <ViewCriteria
    Name="RepairSearchVVOCriteria"
    ViewObjectName="com.services.cs.vvo.RepairSearchVVO"
    Conjunction="AND">
    <Properties>
    <CustomProperties>
    <Property
    Name="displayOperators"
    Value="InAdvancedMode"/>
    <Property
    Name="autoExecute"
    Value="false"/>
    <Property
    Name="allowConjunctionOverride"
    Value="true"/>
    <Property
    Name="showInList"
    Value="true"/>
    <Property
    Name="mode"
    Value="Basic"/>
    </CustomProperties>
    </Properties>
    <ViewCriteriaRow
    Name="vcrow1"
    UpperColumns="1">
    <ViewCriteriaItem
    Name="CreationDate"
    ViewAttribute="CreationDate"
    Operator="="
    Conjunction="AND"
    Value=":createDate"
    IsBindVarValue="true"
    Required="Optional"/>
    </ViewCriteriaRow>
    </ViewCriteria>
    I then dragged the criteria into the page. When running it I get the following:
    AND SR.customer_id =:psCustomerId) QRSLT WHERE ( ( (CREATION_DATE = :createDate ) ) )
    <ViewObjectImpl><bindParametersForCollection> [3510] Bind params for ViewObject: [com.xxx.services.cs.vvo.RepairSearchVVO]RepairSearchAM.RepairSearchVVO1
    <OracleSQLBuilderImpl><bindParamValue> [3511] Binding param "psCustomerId": 34758
    <OracleSQLBuilderImpl><bindParamValue> [3512] Binding param "createDate": 2010-02-18
    Which never brings back any data. My date's look as follows in the database:
    '18-FEB-10'
    I never get any results for the date. I've also tried using the to_char to format the date as the same format, but that always gives a variety of errors. This is driving me batty =0 Any ideas on why it never pulls back data?
    Thanks, Graeme.

  • Querying by date field parts: month, year

    Hi,
    is there ability in JDOQL to get month or year of date field and use them in
    filter? Example:
    search(Payment.class, "processDate.ext:getYear() == (select
    c.createDate.ext:getYear() from Client c where clientID == c.ID)");
    thanks,
    Povilas

    is there ability in JDOQL to get month or year of date field and use them in
    filter? Example:
    search(Payment.class, "processDate.ext:getYear() == (select
    c.createDate.ext:getYear() from Client c where clientID == c.ID)");Unfortunately, there is not. As your example indicates, however, you could code
    a custom query extension in Kodo to extract the year from a date in SQL.

  • Concatenate Date fields as month and year

    Hi,
      I want to concatenate the field bseg-augdt as month and year.
    And have to append as a seperate field (Fiscal month | fiscal year) in the output.
    Plz help me to overcome this issue.
    Thanks and Regards,
    Karthik
    Moderator message: very basic, please try yourself and search for information before asking.
    locked by: Thomas Zloch on Aug 4, 2010 1:22 PM

    Env : ORACLE REPORTS 9I
    I am passing 3 parameters to the report:
    Parameters are of type CHAR
    Report Parameters
    Year / Month :   2005 / AUG
    Effective Date :
    The colunm in table is eff_date
    eff_date
    01/08/2005
    02/08/2005
    03/08/2005
    15/09/2005
    17/09/2005
    18/09/2005
    29/09/2005The problem is:
    1)If I dont enter anything,I just get displayed 2 record for the above.
    It should display all records rather than 2.
    2)If I enter Effective date as 01-AUG-2005,no records are displayed.
    This is my code:
    Select col1,col2
    from   TableA
    where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) ) 
    AND     TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH,                                                                                                          'yyyymon') ,
                                               TRUNC(ch.eff_date) )
          )Shud i change the AND to OR?

  • Problem with Date fields in Search panel

    Hi all,
    I use TP2 and in my jspx page I have a search panel with two date fields and table where the results is displayed. But there is a problem with these date fields, because when I search dates the results is nothing even I retype the date from table. Also I have other pages where this problem exist with same structure.
    Could somebody help me with some advice?
    Thanks in advance!

    Hi Frank,
    Thanks for the answer.
    I use the standart method to make search panel with drag and drop the data control to the page. The other search panel fileds work fine, only the date fileds are problem. Maybe something in view object doesn't work properly.
    Here I post the code from my page.
    <table border="1" style="margin:5px;">
    <tr>
    <td>
    <af:showDetailHeader text="ТЪРСЕНЕ" disclosed="true"
    inlineStyle="width:780px;">
    <table cellspacing="2" cellpadding="3" border="0">
    <tr align="left">
    <td align="right">
    <af:outputLabel value="#{bindings.EGN.hints.label}"/>
    </td>
    <td align="left">
    <af:inputText value="#{bindings.EGN.inputValue}"
    label="#{bindings.EGN.hints.label}"
    columns="#{bindings.EGN.hints.displayWidth}"
    maximumLength="#{bindings.EGN.hints.precision}"
    simple="true"/>
    </td>
    <td align="right">
    <af:outputLabel value="#{bindings.LNC.hints.label}"/>
    </td>
    <td align="left">
    <af:inputText value="#{bindings.LNC.inputValue}"
    label="#{bindings.LNC.hints.label}"
    columns="#{bindings.LNC.hints.displayWidth}"
    maximumLength="#{bindings.LNC.hints.precision}"
    simple="true"/>
    </td>
    <td align="right">
    <af:outputLabel value="#{bindings.AccPersonID.hints.label}"/>
    </td>
    <td align="left">
    <af:inputText value="#{bindings.AccPersonID.inputValue}"
    label="#{bindings.AccPersonID.hints.label}"
    columns="#{bindings.AccPersonID.hints.displayWidth}"
    maximumLength="#{bindings.AccPersonID.hints.precision}"
    simple="true"/>
    </td>
    </tr>
    <tr align="left">
    <td align="right">
    <af:outputLabel value="#{bindings.PersonName.hints.label}"/>
    </td>
    <td align="left" colspan="5">
    <af:inputText value="#{bindings.PersonName.inputValue}"
    label="#{bindings.PersonName.hints.label}"
    columns="#{bindings.PersonName.hints.displayWidth}"
    maximumLength="#{bindings.PersonName.hints.precision}"
    simple="true"/>
    </td>
    </tr>
    <tr align="left">
    <td align="right">
    <af:outputLabel value="#{bindings.DateFrom.hints.label}"/>
    </td>
    <td align="left">
    <af:inputDate value="#{bindings.DateFrom.inputValue}"
    label="#{bindings.DateFrom.hints.label}"
    simple="true">
    <af:convertDateTime pattern="#{bindings.DateFrom.format}"/>
    </af:inputDate>
    </td>
    <td align="right">
    <af:outputLabel value="#{bindings.DateTo.hints.label}"/>
    </td>
    <td align="left">
    <af:inputDate value="#{bindings.DateTo.inputValue}"
    label="#{bindings.DateTo.hints.label}"
    simple="true">
    <af:convertDateTime pattern="#{bindings.DateTo.format}"/>
    </af:inputDate>
    </td>
    </tr>
    <tr>
    <td align="right">
    <af:commandButton actionListener="{bindings.Execute.execute}"
    text="#{bundle.FindBtn_LABEL}"
    disabled="#{!bindings.Execute.enabled}"
    icon="/images/find.png"/>
    </td>
    <td align="left">
    <af:commandButton text="#{bundle.FindClearBtn_LABEL}"
    icon="/images/find_clear.png"
    action="#{PeopleBean.onClearVCBtn}"/>
    </td>
    </tr>
    </table>
    </af:showDetailHeader>
    </td>
    </tr>
    </table>
    Also I have a result table for the search panel, but I don't believe the problem can be there because it works fine when I search in fields different by inputDate.
    Do you have any suggestions?

  • Formatted Search for Delivery Date field in SO not working

    Hi All
    Can anyone help me as to why my formatted search is not working?
    I am currently using SAP B1A SP01 Patch 19.
    I have created a user query as follows:
    SELECT $ [$10.0.DATE] + 5
    When I add this to the delivery field within the Sales Order and bring through the saved query which I set to auto refresh when the Posting Date field changes and to Display Saved Values it doesn't work.
    Any ideas?
    Thanks and best wishes
    Gail

    HI Gail,
    If I am not mistaken you want to add days to the posting date...if that is so then try this out:
    SELECT $[ORDR.DocDate.DATE]+5 From ORDR T0 For Browse
    Set The indicator to Auto Refresh when the fields change
    Nagesh

  • Adding a year to the current date field

    Hello,
    Can any one please help on how to add a year to the current date field.
    e.g 7/19/2011 plus a year = 7/19/2012
    Thanks,
    Han Dao

    If you had a field DateTimeField1 and wanted to display the following year in DateTimeField2, you could do the following in JavaScript;
    var d1 = util.scand("yyyy-mm-dd", DateTimeField1.rawValue);
    if (d1 !== null)
    d1.setFullYear(d1.getFullYear()+1);
    DateTimeField2.rawValue = util.printd("yyyy-mm-dd", d1);
    Good luck
    Bruce

  • How to compare table's date field with dropdown year field

    Hi All,
    I have one requirement to display the selected rows from a database table based on the selection of drop down.
    Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
    Now, I want to compare table's DATE field with my dropdown field.
    Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
    How to compare this fields?
    Can any one please give me solution for this...!
    Thanks in Advance!

    Hi  sreelakshmi.B,
    try the following:
    DATA lt_dats        TYPE TABLE OF dats.
    DATA l_dat_i        TYPE          i.
    DATA l_dat_c_4(4)   TYPE          c.
    DATA l_dat_c_12(12) TYPE          c.
    DATA l_dats_from    TYPE          dats.
    DATA l_dats_to      TYPE          dats.
    *Move Date from Integer to Char
    l_dat_c_4 = l_dat_i = 2005.
    *Create Date From use in WHERE-Clause
    CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_from
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *Create Date To use in WHERE-Clause
    CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_to
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    * Select records in range
    SELECT *
           FROM [DBTAB]
           INTO TABLE [ITAB]
           WHERE [DATE] BETWEEN l_dats_from
                        AND     l_dats_to.
    Regards
    REA

  • F4 ( Search Help ) for date field  on the selection screen

    Hi Freinds,
    i have used WDR_SELECT_OPTIONS In my component, i have one date field on selection screen(BUDAT), for this date field i want seach help 
    this is my code
    create a range table for Posting Date
    lt_range_table = wd_this->m_handler->create_range_table(
                                                              i_typename = 'BUDAT' ).
    add Posting Date  to the selection
    wd_this->m_handler->add_selection_field( i_id = 'BUDAT'
         i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
                                               I_VALUE_HELP_ID = '??????'
                                               I_DESCRIPTION = 'Posting Date'
                                               it_result = lt_range_table ).
    can any one help me
    Thanks
    Srini

    hi sarbjeet 
    i created search help in dictionary and i used that search help in my program, but still its now working , any other ideas
    Thnx
    srini

  • Search help for DATE field

    HI all,
    I want to attach search help for a DATE field created in screen painter.
    For PERNR, PREM is attached. Similarly what is the statndard search help name for DATE field?
    Thanks,
    Shanthi.

    Hi ,
    Declare the date field as sy-datum ,
    parameters : date type sy-datum .
    This shud bring the standard search help for date .
    Thanks ..Get back for any issues.
    Anil

Maybe you are looking for

  • How to create a Report from WebDympro

    Hi All, I just want to know how I can create a report from WebDynpro? I need to pull data from R/3 using a RFC function module, but I don't know if it exists a software to create reports. Thanks in advance Alexis Ramirez

  • Error while uploading SSL certificate in Visual Admin

    Hi, I generated a .cert base 64 certificate from STRUST tcode of my ECC server.I'am tring to load the certificate in visual administrator under key storage --> ADS Certs. while loading,  it is giving me an error message stating " Key Store : ID21113:

  • CAN I MAKE A RESERVATION ON AN IPAD 16GB WIFI?

    Hi! I am looking for an iPad 16GB Wifi. I live in Norway, that makes it kind of hard to get atm. At June 19th Im going to NYC, I will visit the Apple store in Fifth Avenue the 20th. Is it any way I can reserve an iPad 16GB Wifi version? - Christian F

  • Transfer photos to apple tv

    I have a new HDTV and want to use it to show iPhoto albums using Apple TV. Where can I get step by step directions to share photos from my MacBook Pro and iPad?

  • The state of retina support - want a clear and concise answer

    Adobe, I realize that digital publishing is probably a very complex and difficult business, and that you're all very busy to get things working properly, and easily, with the amazing Adobe tools we're all used to. However, I have noticed from the sta