Optional date range parameters

Hi All,
I have a 2 parameters from date and to date.When I didn't selected anything in parameters list then it should show all dates data.
Please suggest how to create a optional parameter for date range parameters.

Hi Sastry,
For getting optional date parameter we are using formula like this  in record selection
Not(hasvalue({?Date})) OR ({employee.Date} = {?Date})
But the solution you provided doesn't contain not .Can you please suggest what is the difference.

Similar Messages

  • Code or idea of adding date range parameters

    Thanks guys for answering all my past queries.
    Another question arises
    I don't know how to write code for date range value parameters for a report.
    i-e
    I have a report that takes a start date and end date range parameter.
    I can pass all the other parameters to CrystalReportViewer through code but dont know how to write code to pass date range parameters.
    Please help!

    Hi,
    I assume you are using JRC on CR XI or XI R2.
    For Single Range Values:
    Calendar calendar1 = Calendar.getInstance();
    calendar1.clear();
    calendar1.set(yyyy,mm,dd);
    Date date1 = calendar1.getTime();
    Calendar calendar2 = Calendar.getInstance();
    calendar1.clear();
    calendar.set(yyyy,mm,dd);
    Date date2 = calendar2.getTime();
    // use yyyy,mm,dd,hh,mm,ss for DateTime parameter.
    ParameterFieldValue rangeVal = createSingleRangeVal(date1, date2, RangeValueBoundType.inclusive, RangeValueBoundType.inclusive);
    paramFieldController.setCurrentValue("", "<Parameter Name>", rangeVal);
    For Multiple Range Values:
    Object [] beginVals = {date1, date2, date3};
    Object [] endVals = {date4, date5, date6};
    //Where  date1 - date4 is range 1, date2 - date5 is range 2 and date3 - date 6 is range 3.
    RangeValueBoundType [] beginBoundTypes = {RangeValueBoundType.inclusive, RangeValueBoundType.exclusive, RangeValueBoundType.noBound};
    RangeValueBoundType [] endBoundTypes = {RangeValueBoundType.noBound, RangeValueBoundType.inclusive, RangeValueBoundType.exclusive};
    ParameterFieldValue [] multiRangeVal = createMultiValRangeParameter(beginVals, endVals, beginBoundTypes, endBoundTypes);
    paramFieldController.setCurrentValues("", "<Parameter Name>", multiRangeVal);
    I hope this helps.
    Thanks
    Aasavari

  • Howto add date range parameters to linechart?

    I'm using SQL Server 2014 and SSDT 12. I have a linechart generated using three fields - FCP, NFS (both integers) and TimeIndex (the datetime over 30 days).
    I see how to add parameters but how do I allow users to specify a date range? For example to only view data from 01/12/2014 - 07/12/2014.
    Thanks in advance
    Adam

    Found this myself eventually in case anyone else needs it:
    http://100rov.blogspot.co.uk/2012/12/create-calendar-parameter-with-start.html

  • Creating Date Range Parameters

    Hi,
    I have created the date range parameter using the parameter fields, but when I refresh the report the data does not get affected. It gives the same result as it would have given without the date parameter. What needs to be done in order for the parameter to actually work.?
    Thanks

    By adding a parameter you just defined a variable/ condition. Now when you want to display your results based on the values selected, you mean to implement a condition , similar to where clause in usual queries.
    For this we use the record selection formula, meaning to say the records would be selected based on those conditions.
    For eg. You are using the date range and you want to display data falling within those date range. That is you need to create a condition :
    1. What condition u2013 you have already created the parameters
    2. Implement that in where clause u2013 you need to create a record selection formula (menu Report -> Selection Formulas -> Record )
    You may probably need to use something like : in {?DateFrom} to {?DateTo}

  • Date range parameters are off by one day

    I have a Start Date and End Date parameter in my SSRS report.  The results are off by 1 day.  For example if I enter 4/2/2015 and 4/20/2015 it will return a few results from 4/1/2015 to 4/19/2015.  I think maybe it's a problem with my date
    conversion in T-SQL, but thought someone more experienced than me would have seen this before.
    Thanks

    Yes 
    The safest way to write a date range comparison would be as below
    WHERE DateField >= @StartDate
    AND DateField < DATEADD(dd,1,@EndDate)
    If you want results with @EndDate inclusive
    see more details here
    http://visakhm.blogspot.ae/2012/12/different-ways-to-implement-date-range.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Passing date range parameters in MDX Query

    Following is my mdx query
    SELECT NON EMPTY
        [Measures].[Cache Attendees Count]
    ON COLUMNS,
    NON EMPTY
        ([Cache Attendees].[Visit Id].[Visit Id].ALLMEMBERS *
        [Cache Attendees].[User Id].[User Id].ALLMEMBERS *
        [Cache Attendees].[Screen Name].[Screen Name].ALLMEMBERS *
        [Cache Attendees].[User Type Id].[User Type Id].ALLMEMBERS *
        [Cache Attendees].[User Type Name].[User Type Name].ALLMEMBERS *
        [Cache Attendees].[Group Date Count].[Group Date Count].ALLMEMBERS *
        [Cache Attendees].[Insert Time Stamp].[Insert Time Stamp].ALLMEMBERS )
        DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
        SELECT
                STRTOMEMBER(@FromCacheAttendeesInsertTimeStamp) : STRTOMEMBER(@ToCacheAttendeesInsertTimeStamp)
            ) ON COLUMNS FROM (
            SELECT
                STRTOSET(@CacheAttendeesConferenceId) ) ON COLUMNS FROM [Cube_Attendee])
            WHERE ( IIF( STRTOSET(@CacheAttendeesConferenceId).Count = 1, STRTOSET(@CacheAttendeesConferenceId), [Cache Attendees].[Conference Id].currentmember ) )
    CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
    I want to filter my cube with three parameters
    1. @CacheAttendeesConferenceId
    2. @FromCacheAttendeesInsertTimeStamp
    3. @ToCacheAttendeesInsertTimeStamp
    When i pass following parameters
    ConferenceId = 1, StartDate='2010-01-28T00:00:00', EndDate='2010-02-03T00:00:00'
    Then it show records
    But When i pass following parameters
    ConferenceId = 1, StartDate='2010-01-27T00:00:00', EndDate='2010-02-03T00:00:00'
    Then it display message No Data Available
    PLease help me on this issue why not FromDate & ToDate range works properly.

    Step1:- First i create a SSAS datasource. Then i create a cube for my table CacheAttendees.
    It has following columns:-
    [Cache Attendees].[Conference Id]
    [Cache Attendees].[Group Date Count]
    [Cache Attendees].[Insert Time Stamp]
    [Cache Attendees].[Screen Name]
    [Cache Attendees].[User Id]
    [Cache Attendees].[User Type Id]
    [Cache Attendees].[User Type Name]
    [Cache Attendees].[Visit Id]
    Step2:- Then i create a dimension with this cube with all columns.
    Step3:- Then i deploy my SSAS project.
    Step4:- Use SSAS datasource in my SSRS datasource.
    Step5:- Create a report with chart control. Add a parameter ConferenceId. Set default to 1. When i preview my report then it show Cache Attendees].[Conference Id].[1] in header of report instead of that, When i pass the parameter value as 1 then report cannot show & throw an error. I want to pass this parameter at runtime.
    Step6:- Please help me how is it possible to pass parameter at runtime.

  • Date range to be displayed  & Displaying multiple values on the report

    Hi,
    I have date range parameters, but I also need it to be displayed it on the report. Is there any way I can display it. E.G If a parameter is created one can drag and drop it on the report if it needs to be displayed on the report, I tried to do the same for the date range parameter but it does not work.
    Also If a parameter is created by selecting the option 'Allow Multiple Values', and if you drag and drop it on the report only the first value is displayed and the rest does not show. Has anyone tried this before and been successful in displaying multiple values in the report.
    Thanks in advance.

    Hi,
    A multi-value parameter is actually treated as an array in Crystal Reports.
    To display the values selected in the parameter, create a formula from the Field Explorer and type this code:
    Join({?ParameterName},",");
    Place this formula on the header or the footer sections of the report.
    Regarding the date range issue, please follow Sastry's advice and it should work fine.
    Make sure you're using the parameter in the Minimum and Maximum functions. For eg: If I was to create a date range parameter called OrderDate, my formula to show the start date would look like this:
    Minimum({?OrderDate})
    -Abhilash

  • Schedule a report with passing range parameters

    I have wrote a program to run the crystal report in BO server and email to the user. The program can pass the parameter to the crystal report and generate different result/ report. It works well with string parameters, int parameter and date parameter. But when I pass the date range parameters, the CR in BO always displays error "Information is needed before this report can be processed. ", and in the CR history, the Parameters field is "No Parameter"
    For single parameters, I will use the setValue() of IReportParameterSingleValue to set the param value
    IReportParameterSingleValue v = prompt.getCurrentValues().addSingleValue();
    v.setValue(paramValueArray<i>);
    but I dunno how to set the date range value. Anyone ve ideas on this?
    Here is some of my sample code.
    rangeValue.setBeginValue(dateValue1);
    rangeValue.setEndValue(dateValue1);
    rangeValue.getEndValue());
    rangeValue.setLowerBoundType(RangeValueBoundType.inclusive);
    rangeValue.setUpperBoundType(RangeValueBoundType.inclusive);
    newParam.getCurrentValues().add(rangeValue);

    I am not sure if you are using RAS or Enterprise SDK, but here are some code snippets to set range report parameters:
    For scheduling:
    // oReport is IReport object holding the crystal report.
    oReportParameter = oReport.getReportParameters().get(i);
    currentRangeValue = oReportParameter.getCurrentValues().addRangeValue();
    currentRangeValue.getFromValue().setValue(dateParameter);
    currentRangeValue.getToValue().setValue(dateParameter);
    For viewing:
    ParameterFieldRangeValue pfrv = new ParameterFieldRangeValue();
    pfrv.setBeginValue(dateTimeValue);
    pfrv.setEndValue(dateTimeValue1);
    pfrv.setLowerBoundType(RangeValueBoundType.inclusive);
    pfrv.setUpperBoundType(RangeValueBoundType.inclusive);
    pf.getCurrentValues().add(pfrv);
    f.add(pf);
    f is Fields object and pass that to viewer.

  • Date Range Parameter's Restriction

    Could you someone please tell me how BO restricts date range parameter when the users tries to run a query?  Often times, users simultaneously try to get several years of data dumped into a single query.  Some users even forget to enforce the date range, which causes the query to try to get the data from the beginning of time. 
    How do we as a BO developer create some sort of date range restriction so that it can prevent users from overloading a query?  If the users want to get several years of data, he/she has to run a query in batches instead of doing it all at once.
    I hope there is a way that we can create a custom informational error message for each report to prevent users from trying to query too many months or years of data.  Some reports may hit small and well-indexed tables that allow large date range queries.  But, some reports query against large and poorly indexed tables, which can potentially cause adverse effect on performance without date range restriction. 
    Any thoughts or advices on how to implement such things (if possible).  I am also afraid that the answer will be "currently not doable".  If so, any ideas if the next version of BO will allow such functionality, or if it is at least in the plan at all?  Thank you so much for your insight and sharing.  Have a great day!

    Dear Amr,
    Thanks so much for your quick reply!  The field I want to create a restriction on is called RESULT_DT_TM.  When I saw the "where" section of the field, I just don't see how I can apply my START_DT_TM and END_DT_TM parameters on this field so that START_DT_TM and END_DT_TM cannot be more than 365 days apart.  If my query does not use parameters called START_DT_TM and END_DT_TM, this "where" section will not be valid? 
    I don't think the solution has to be on the field itself but rather on the parameter START_DT_TM and END_DT_TM.  What I want is that as long as START_DT_TM and END_DT_TM are more than 365 days apart, it does not matter what field these parameters are running against. The screen would then display something saying "your date range parameters for this report must be within 365 days.  Please revise your date range on query".
    Sorry, I am PL/SQL report programmer, and not familiar with what BO can do.  So, is there anyway that can make my dream come true?  Thanks a bunch again, Amr.

  • User-filtered report based on date range

    I am struggling with trying to implement a basic search that includes an optional date range for the data. The form looks the way I want it, but I can't seem to get the right syntax in the query. I can't get anything other than "no rows" to show up in the query if I implement a clause selecting records based on the time.
    Here is a working query (without the time):
    select m.AUDIT_ID, m.TIMESTAMP, m.LOC_ID, a.AREA, s.SUBAREA, d.OBSERVATIONS
    from transys.SAFETY_AUDIT_MAIN m, transys.SAFETY_AUDIT_DETAIL d,
    transys.SAFETY_AUDIT_AREA a, transys.SAFETY_AUDIT_SUBAREA s
    where m.AUDIT_ID = d.AUDIT_ID (+)
    and d.AREA_ID = a.AREA_ID
    and d.SUBAREA_ID = s.SUBAREA_ID
    and s.SUBAREA_ID NOT IN (198,199,398,399,498,499,798,799,898,899,999)
    and (instr(upper(a.AREA),upper(nvl(:P210_SEARCH,AREA))) > 0
    or instr(upper(s.SUBAREA),upper(nvl(:P210_SEARCH,SUBAREA))) > 0
    or instr(upper(d.OBSERVATIONS),upper(nvl(:P210_SEARCH,OBSERVATIONS))) > 0)
    I want to compare the m.TIMESTAMP column with page items P210_FROM_DATE and P210_TO_DATE.
    I would also like to add in an optional filter comparing m.LOC_ID to P210_LOCATION, and I can't seem to figure out the "optional" part.
    Any ideas would be helpful.

    The query as I posted it returns 3 values, but it is not syntactically identical to the one APEX is using. I would be happy to get 3 rows in APEX because at least that way I would know I have the date formatting correct, and just needed to tweak the logic. When I execute the query in APEX, however, I get either "there is no data to display" or I get a formatting error - "X is not a valid month" - depending on how I use TO_CHAR and TO_DATE to try and synchronize the various date inputs with the field.
    If it is a query issue (which it may be), I am still suspecting that it is something to do with the formatting of the dates involved. Just as in APEX, it could be something simple, but I suspect it is a mismatch in the formatting somewhere.
    Maybe I'll try making a view of the underlying table and experimenting with the date in the view. That should enable me to see if it is the formatting in the query or the formatting in APEX that is causing the problem. Or it could even eliminate formatting as the problem as well.
    PS. I had a similar struggle trying to implement some triggers against this database that used date values. NLS_TIMESTAMP_FORMAT is set to 'YYYY-MM-DD HH24.MI.SS.FF'. I ended up converting every date that I pulled from the database into a known format with TO_CHAR and then converting it back into a date with TO_DATE. It was the only way to be able to compare the date values without getting these same kinds of errors.

  • How to calculate a week & Month in given date range (not for sele-options)

    Hi ,
      I have defined 2 date parameters in sel-screen (Plz remember that date variable are not a SELECT-OPTIONS).  Now i want ot display week nos & monts in output.
          Ex: date1: 20080101 & date2: 20080229. then
                    weeks : 1, 2, 3,---9.
                    months: jan-08, feb-08.
    Plz help me with block of code or any FM.
    Regards,

    Hi Srikanth,
            The FM HR_99S_INTERVAL_BETWEEN_DATES   is doesn't existing, but there is a fm HR_MX_INTERVAL_BETWEEN_DATES but it returns no of Years & Days.
           But i found some FM which r returns no of months for given date range. but my requirement is, want to display the month no bw 1 to 12. (ex: dat1=15-03-2008 & dat2= 01-06-2008 then in month fields 03,04,05 & 06. ).
    Plz help me on this.
    -Regards.

  • Date parameters for Date range

    Hi,
    I got a report with 2 parameters From Date and To Date and i have 2 columns items in the report absence start date and absence end date.
    i have to make sure that the date range satisfies all case's
    what is the best way that I can these validation rules in discoverer on these dates...?
    case's are something like this:
    1 (absence start date > from date; absence end date > to date)
    2 (absence start date > from date; absence end date < to date)
    3 (absence start date < from date; absence end date > to date)
    4 (absence start date > from date; absence end date < to date)
    Any help would be really appreciated.

    Using conditions in Discoverer is just like specifying a where clause in SQL with AND and OR. You should be able to use conditions for what is being described below.
    Are you not able to do that using conditions in your report ?

  • Select-options.. Date range..URgent...

    Hi All,
    Can anyone let me know.. how to give last one month date range in select options.
    Regards,
    Parvez.

    Hi,
    In the INITIALIZATION event you can do that.
    v_month = sy-datum+4(2) - 1.
    v_year = sy-datum+0(4).
    concatenate  v_year v_month 01 to v_date1
    concatenate  v_year v_month 31 to v_date2
    Or get the 1st and last dates of the last month and
    s_date-low = date1 (1st date of last month).
    s_date-sign= 'I'
    s_date-high = date2 (last date of last month).
    s_date-option = 'BT'
    append s_date.
    reward if useful
    regards,
    anji

  • Date range by week based on input parameters

    Afternoon folks -- I need to produce a report which will be displayed based on weeks.
    There are two input parameters: P_FROM_DATE and P_TO_DATE
    I need to find the date ranges in weeks starting on THURSDAY and ending on a WEDNESDAY. For example, if my P_FROM_DATE is 01-AUG-2012 and P_TO_DATE is 11-SEP-2012, I need to show the following weeks in this fashion:
    02-AUG-2012 - 08-AUG-2012
    09-AUG-2012 - 15-AUG-2012
    16-AUG-2012 - 22-AUG-2012
    23-AUG-2012 - 29-AUG-2012
    30-AUG-2012 - 05-SEP-2012
    06-SEP-2012 - 12-SEP-2012So, the idea is to start the first THURSDAY following the P_FROM_DATE and end on the WEDNESDAY preceding the P_END_DATE..
    Thanks!

    Hi,
    here's one way:
    WITH     params          AS
         SELECT  DATE '2012-08-01'     AS p_from_date
         ,     DATE '2012-09-19'     AS p_to_date
         FROM     dual
    ,     end_points     AS
         SELECT     TRUNC ( p_from_date + 4
                    , 'IW'
                    ) + 3          AS first_thursday
         ,     TRUNC ( p_to_date + 4
                    , 'IW'
                    ) - 5          AS last_wednesday
         FROM    params
    SELECT     first_thursday + (7 * (LEVEL - 1))     AS week_start_date
    ,     first_thursday + (7 * LEVEL) - 1     AS week_end_date
    FROM     end_points
    CONNECT BY     LEVEL     <= ( last_wednesday
                      + 1
                      - first_thursday
                      ) / 7
    ;TRUNC (dt) is the beginning of the ISO week that contains the DATE dt.
    The "magic number" 4 is used because the ISO week begins on Monday, 4 days later than your week begins, so
    TRUNC ( dt + 4
          , 'IW'
          )is the Monday in the same Thursday-Wednesday week as dt.

  • Date Ranges: Page Items or 'Input Parameters'?

    Hi,
    What is the best way to implement an user input date range qualifier in worksheets?
    So far I've only been able to achieve this by using item classes on a date field. Very messy.
    Anyone else doing this?

    Thanks Gveeden.
    How do you setup your date parameters?
    Are they 'conditions'? If so, how do you let the Users specify values in User Edition?
    Hope you can help out.
    Thanks already,
    Peter Verhoeven.

Maybe you are looking for