Default Data Parameter
Post Author: despec
CA Forum: General
I have read that in previous CR version (before XI), you could default a date parameter to the current date. Is there any way in CR XI to achieve this or our we SOL until we upgrade to CR 2008 (which I hear does allow date parameter defaults)?David
Hi,
It depends which version of Discoverer you are using. Search the Discoverer forum (http://forums.oracle.com/forums/search.jspa?objID=f56&q=SYSDATE+parameter) or check these links (Default parameter value to sysdate Default a parameter value to sysdate for possible solutions.
Rod West
Similar Messages
-
Default Date parameter to current date
Using Crystal Reports 2008 version 12.1.0.892
I have a Stored Procedure for the report that among others requires a StartDate and EndDate parameter.
It appears that I can not easily/simply set the default for this parameters to the current date.
In the properties dialog for the parameter the Default value appears to be just a text field. I can type in a value, but I can not make it always have the current date selected.
This report also has an End Date that we would like to have default to the current date(no time) plus one day.
We can do this using Reporting services, but I can not find a way to do this as easily in crystal reports. What am I missing?
ThanksWell here's a little quick tip for reports have to be scheduled and require date parameters. I've used this on lots of reports...
For the bulk of our scheduled reports, the user typically wants to see data for either the current month or the previous month. For example management may want a production report scheduled to run at the end of every week for the current month so that they can track month to date progress. They will also want the same report run on the 1st of the month for the previous month so that they have a final monthly total.
Here's how I do it with just one report...
1) Create a text parameter called {?DateRange}
2) Give it 2 static LOVs... Current Month & Previous Month
3) Build out the SQL Command (I use a lot of them... Most of our vendors aren't nutty about clients adding SPs to their DBs)
4) Drop in the following block of code at the top of the SQL Command...
DECLARE @DateRange CHAR(15)
DECLARE @BEG DateTime, @END DateTime
SET @DateRange = '{?DateRange}';
IF @DateRange = 'Current Month' SET @BEG = DATEADD(mm, DATEDIFF(mm,0,GETDATE()),0)
ELSE SET @BEG = DATEADD(mm, DATEDIFF(mm,0,GETDATE())-1,0);
IF @DateRange = 'Current Month' SET @END = DATEADD(ms,-5,DATEADD(mm, DATEDIFF(mm,0,GETDATE())+1, 0))
ELSE SET @END = DATEADD(ms,-5,DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0));
5) Modify the WHERE clause of the SQL to pull dates between @BEG AND @END
6) Add the DateRange parameter in the Parameter List of the Command.
At this point the user has just 2 date range options... Current Month & Previous Month.
From there you can upload to the CR Server and schedule it.
Jason -
How do you set up a default Date To based on Date From for report parameter
I'm working on a report. I have been asked to set up a default Date To based on Date From for the report parameters. I mean when running a report, if an end user selects a value for parameter Date From, system will automatically populate the Date To parameter based on the Date From + 6 days.
I guess there's gotta be something to do with Value Set. Do any of you guys know how to go about this?
Any suggestion is greatly appreciated.
DennisYou should be able to retrieve the value of other valueset using :$FLEX$.<valuesetname> I'm not sure about the exact syntax, it's been a while since i worked with applications.
-
Crystal Reports Date Parameter Default Value OPtion Empty
Is there a way to set a default date value for a Date Parameter? It is shown empty, it only allows to set a fixed date, i.e. 10/10/2013. But it doesn´t allow me to use a formula (which has a CurrentDate inside), so I can set, for example, today's date as default.
How can I achieve this? I´m not using Crystal for Enterprise. I'm using Crystal Reports, the normal version.Hi Erika,
The feature is only available in CR for Enterprise at the moment.
If you're OK with selecting the currentdate from the dropdown, here's a workaround:
1) Go to the Database Expert > Click the Connection Name > Select 'Add Command' > Type in a simple sql query that returns today's date. Example for oracle would be:
Select SYSDATE from DUAL
2) Don't link this Command Object with other tables on the report
3) Create a new Parameter > Select 'Dynamic' under 'List of Values' > Under the 'Value' column choose 'SYSDATE' from the command object > Click create parameter > OK
-Abhilash -
Can we pass data-parameter in host
Can we pass a data-parameter to a report using host command in the form.
urgent please
vishalYour answer is quite correct, but it is stupid behavior - how do you build backwards compatibility into a function if you have to specify the keyword 'default'?
For example, I have an existing function that takes one parameter, but I need to alter it to take two parameters. I work for a large bank that has a rigorous change management process, and this function resides in the data warehouse, so many
people can use this function in their code, and I need to ensure that any changes I make are backwards compatible, and don't break any existing code that I don't know about.
If this was a stored proc, I could call it without the optional parameter, and the default value would be applied, but a function needs me to specify the keyword 'default' or to provide a value.
My only option seems to be to create a wrapper function that calls either the old function (if only one parameter is provided) or the new function (if both parameters are provided). Sort of defeats the purpose of having default or optional values. -
Unit Testing: Supplying SYSDATE on a DATE parameter
hi all,
I have a procedure that I'm unit testing and one of the parameter is date, I want to supply a dynamic value to it relative to sysdate but SQL Developer only accepts hard coded date values. Does anyone know how I can supply SYSDATE or SYSDATE-50 to a date parameter directly. I can already solve this by using a wrapper procedure, just wondering if there's a solution to directly supply the value.
Thanks,
AlfredoHi Kranthi.
1. Assuming you are with Plus you can make the parameters optional in the parameters screen (tools -> parameters)
so that if they get NULL as value they will return all data.
2. the second way is if you like to keep it mandatory is to define a default value for the parameter and then take care of the situation in the condition.
for example you'll define the 1-Jan-1900 as your default date for the from_date.
Then in the condition change if you'll define it just as from_date > :P_from_date then you got what you wanted.
BTW In similar situations when you are dealing with varchar you can do a manipulation such as:
from_date > :P_from_date
Or
:P_from_date = '1-Jan-1900'
Tamir -
Help with Setting Previous Month Date Parameter for SSAS via SSRS
Hi All,
Firstly, any assitance is greatly appreciated.
Now, I am working on developing a report for a business area that will be sent on the first of every month. The report will contain data for all records created in the previous month, current year.
I have been able to successfully implement a default year parameter, which will default to current year-
="[REFERRAL LODGEMENT DATE].[CAL YEAR].&["+CSTR(Year(Today))+"]". However, when I attempt to set a previous month paramater it is not setting when the report is generated. The code I have used
is as follows:
="[REFERRAL LODGEMENT DATE].[CAL MONTH NAME].&["+CSTR(Month(Today)-1)+"]"
CheersBefore you spend more time trying to fix the parameter, let me suggest that you can write MDX to come up previous month data.
if you can't go that route, couple of things to consider for your approach:
1) don't subtract 1 from January that won't work. you'll need to handle it using the ssrs expression.
2) when you use the month function it's going to return a month index so effectively you are passing something like [REFERRAL LODGEMENT DATE].[CAL MONTH NAME].&[7] to SSAS, is that the current format?
you can use the MonthName function to get month names but again make sure that the formatting is right.
to see the parameter value, you can display it on the ssrs report and see if it's the right format.
Paras Doshi (Blog: ParasDoshi.com | Twitter:
@Paras_Doshi ) -
How to give specific default date with expression in SSRS
Hi,
I have to pass some specific kind of dates in "Default Values" section of parameter.
1st is whenever SSRS report run for any year in default date I want to pass value 1/1/(Current Year), for this I tried many way like , = "1/1/" + DatePart("Y",Now()) also = "1/1/" + Year(Now()) but it
is giving me error. When I tried both part individually "1/1/" and DatePart("Y",Now()) , it is working but when I join them with + sign it is giving me error that "input string is not in correct format"
2nd I want to set up like when package run in month of April, it takes default date as "(Previous Month, which is May)/1/(current Year)" so if I am running report on 4/5/2013 then it in default date it should take 3/1/2013.
Please help me with the expression. Thanks in advance.
VickyHi Visakh,
Thanks again.
I have one more question, I also have start date and end date. In start date I can put your expression as you gave me as below,
=DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,CDate("01/01/1900"),Now())-1,CDate("01/01/1900"))
But can you please help me with End date expression?
In End date I want to put previous month's last date. For example, if active batch is running package on
12/16/2013 then for End Date parameter it should value "11/30/2013"
For 1/16/2014 then for End Date parameter it should value "12/31/2013"
For 3/16/2013 then for End Date parameter it should value "2/28/2013"
Thanks for your help in advance.
Vicky -
Hi,
I have an SSRS report with Dates Parameter. it is compsed of FROMDATE and TODATE. The default value of FROMDATE is the current date and TODATE i added plus 1. This reports will get the transaction for Shift 1 and Shift 2. the shift1 start at 6:00AM of the
current date until 6:00PM, then the shift2 will start from 6:00PM of the current date until 6:00AM of the next day.
Here is the code: I set this code in the expression parameter value
FROMDATE : =DATEADD("d",0,Today) --the value is 6/11/2014 --current date
TODATE: =DATEADD("d",+1,Today) --the value is 6/12/2014 --next day
My requirements:
I wanted the date parameter to be dynamics. WHen the time of TODATE falls on 6:00AM, the FROMDATE will change to 6/12/2013 while the TODATE will change to 6/13/2014.
For ex. tomorrow 6/12/2014 6:00AM the value of these two paramter will be change to
FROMDATE: 6/12/2014
TODATE: 6/13/2014
Thank you in advance.Hi Lenoj,
Was the problem resolved after performing the Visakh’s suggestion? If you are satisfied with his solution, I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings or concerns you may have.
For the issue related to Browser IE9, I would suggest opening a new thread with details information in a corresponding forum. It is more appropriate and more experts will assist you.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Environment: We are running SQL Server 2012 Standard Edition with Analysis Services. Reporting Services on a separate machine. Visual Studio 2010.
I have a Date dimension with a generated table named Time. To the table I have added custom columns to show Week_Ending and Short_Date_Alpha that are used in Excel Reports from the Analysis Services Cubes.
When I attempt to use this dimension in Reporting Services, it times out if I try to use it as a parameter. The report will run for 30 minutes, never surface the parameter selection box and then eventually time-out with an unknown error related to
the time dimension. This is in Visual Studio.
If I pull the dimension directly from the SQL table I can produce a report on it. If I run the full query for the measures with the default date selected it runs in seconds in the query builder. Here are 10 rows of the relevant
table structure:
PK_Date Date_Name Reporting_Year Reporting_Year_Name Reporting_Month Reporting_Month_Name Reporting_Week Reporting_Week_Name Reporting_Day Reporting_Day_Name Short_Date_Alpha End_of_Week_Name Week_Ending WorkDay
2008-01-01 00:00:00.000 Tuesday, January 01 2008 2007-01-07 00:00:00.000 2007 2007-12-02 00:00:00.000 Rpt Dec 2007 2007-12-30 00:00:00.000 Reporting Week 52, 2007 2008-01-01 00:00:00.000 Tuesday, January 01 2008 Jan
1 2008 WE 01/07/08 2008-01-07 00:00:00.000 1
2008-01-02 00:00:00.000 Wednesday, January 02 2008 2007-01-07 00:00:00.000 2007 2007-12-02 00:00:00.000 Rpt Dec 2007 2007-12-30 00:00:00.000 Reporting Week 52, 2007 2008-01-02 00:00:00.000 Wednesday, January 02 2008 Jan
2 2008 WE 01/07/08 2008-01-07 00:00:00.000 1
2008-01-03 00:00:00.000 Thursday, January 03 2008 2007-01-07 00:00:00.000 2007 2007-12-02 00:00:00.000 Rpt Dec 2007 2007-12-30 00:00:00.000 Reporting Week 52, 2007 2008-01-03 00:00:00.000 Thursday, January 03 2008 Jan
3 2008 WE 01/07/08 2008-01-07 00:00:00.000 1
2008-01-04 00:00:00.000 Friday, January 04 2008 2007-01-07 00:00:00.000 2007 2007-12-02 00:00:00.000 Rpt Dec 2007 2007-12-30 00:00:00.000 Reporting Week 52, 2007 2008-01-04 00:00:00.000 Friday, January 04 2008 Jan
4 2008 WE 01/07/08 2008-01-07 00:00:00.000 1
2008-01-10 00:00:00.000 Thursday, January 10 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-06 00:00:00.000 Reporting Week 1, 2008 2008-01-10 00:00:00.000 Thursday, January 10 2008 Jan
10 2008 WE 01/12/08 2008-01-12 00:00:00.000 1
2008-01-11 00:00:00.000 Friday, January 11 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-06 00:00:00.000 Reporting Week 1, 2008 2008-01-11 00:00:00.000 Friday, January 11 2008 Jan
11 2008 WE 01/12/08 2008-01-12 00:00:00.000 1
2008-01-12 00:00:00.000 Saturday, January 12 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-06 00:00:00.000 Reporting Week 1, 2008 2008-01-12 00:00:00.000 Saturday, January 12 2008 Jan
12 2008 WE 01/12/08 2008-01-12 00:00:00.000 0
2008-01-13 00:00:00.000 Sunday, January 13 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-13 00:00:00.000 Reporting Week 2, 2008 2008-01-13 00:00:00.000 Sunday, January 13 2008 Jan
13 2008 WE 01/19/08 2008-01-19 00:00:00.000 0
2008-01-19 00:00:00.000 Saturday, January 19 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-13 00:00:00.000 Reporting Week 2, 2008 2008-01-19 00:00:00.000 Saturday, January 19 2008 Jan
19 2008 WE 01/19/08 2008-01-19 00:00:00.000 0
2008-01-20 00:00:00.000 Sunday, January 20 2008 2008-01-06 00:00:00.000 2008 2008-01-06 00:00:00.000 Rpt Jan 2008 2008-01-20 00:00:00.000 Reporting Week 3, 2008 2008-01-20 00:00:00.000 Sunday, January 20 2008 Jan
20 2008 WE 01/26/08 2008-01-26 00:00:00.000 0
The dimension looks fine when I browse it. It produces the correct information in the Excel Reports, but I cannot get it to work in Reporting Services.
I have deleted dates out of the cubes and processed, then added the Time dimension back in and processed and it still won't work. I have a cube running off a table called Date and that seems to work.
Is the issue with the table name? With the custom descriptions? Something else?How would you best suggest limiting the time frame? Add a filter to the query so that the future dates are not part of the selection? I'm doing some data refresh in the data mart so won't be able to try limiting the selection
for a few hours.
Hi Diane,
Could you please let us know how many available values for your date parameter(the quantity of date dimension in SSAS)? One workaround that we can try to add an additional text parameter which will prefilter the available values in the large parameter list.
Here is similar thread about this topic for your reference, please see:
http://dataqueen.unlimitedviz.com/2012/02/filter-a-parameter-with-long-list-of-values-using-type-ahead/
Regards,
Elvis Long
TechNet Community Support -
CURRENT_DATE in Date parameter
Hello guys!
I'm trying to put the CURRENT_DATE as default value in my date parameter. I'm working on Publisher 11g Data model.
It is possible? If not, any workaround?
Thanks for your time!
Regards,
Arielsorry replied again by mistake
try this
{$SYSDATE()$}
if it helps you assign some points by marking it as correct or helpful and close the thread as answered so that it will be helpful for others
Edited by: Avinash_Varma on Mar 5, 2013 10:52 AM -
How to pass date parameter in URL in system date format
Hi All,
I am working on a requirement where I need to pass the date parameter in URL. Where date format needs to be system default date format. How can we format date without providing specific date format.
Also, I got some post which had below example. Can you let me know what this format does.
'/analysis/report?queryGroupName=Custom-ProjectInfo&TimePeriodBeginning=', <%+%> FCI_CHARFMT(TIME_PERIOD_START_DATE),' <%+%>
'&TimePeriodBeginning_format=17&link_crumb=true'
Waiting for response.
Thanks,
SaloniHi,
If you're running this in SQL*Plus, you can use substitution variables.
If you have a file called my_query.sql, like this
select A.agent_no,
(a.first_name || A.agent_name) as agent_Name,
P.Policy_No,
D.Driver_No,
D.mvr_predict_score,
D.mvr_received
from policy P,
agent A,
Driver D
where D.request_mvr_hit = 'M'
AND D.mvr_predict_Score > 540
And D.request_mvr = 'D'
AND p.fullkey = d.fullkey
AND p.agent_no = a.agent_no
AND d.mvr_received >= TO_DATE ('&1', 'DD-Mon-YYYY') -- New
AND d.mvr_received < TO_DATE ('&2', 'DD-Mon-YYYY') + 1 -- New
order by a.agent_no,
CASE a.producer_type
when 'S' then 1
when 'C' then 2
when 'R' then 3
end
;Then you can run it from SQL*Plus by saying something like:
@my_query 1-Jan-2009 31-Dec-2009&1 in the script will be replace by the 1st argument (1-Jan-2009) and &2 will be replaced by the 2nd argument (31-Dec-2009).
Notice that the last condition adds 1 to the argument
AND d.mvr_received < TO_DATE ('&2', 'DD-Mon-YYYY') + 1 -- Newbut uses the < operator (not <=). The result is that if mvr_received is any time on the last day (e.g. 31-Dec-2009 11:59 pm) will be included. -
Post Author: tegage
CA Forum: Formula
I have many reports that allow the user to specifiy a starting and ending date range. I would like the reports to default to all dates. I can do this by defaulting the start date to "01-01-2000" and the end date to "12-31-2099", but then the calendar tool is useless since there is no TODAY button on the calendar tool and it picks up the default date, i.e., the users will have to do a lot of scrolling through the calendar tool.
The other way is to make the starting and ending date parameters strings and use values like Today, This Week, This Month,.... and reolve them in the record selection formula. This would be nice, but then if the user wants a specific date range, they don't have the calendar tool to use.
Is there a way to take advange of the user-friendliness of string values and still have the calendar tool to use?Post Author: tegage
CA Forum: Formula
Thanks much for the response.
I had done exactly what you described - I had a string parameter for Today, This Week, etc and a set of date parameters - Starting and Ending Date. But, in order to use the Starting and Ending dates in a formula, I had to provide them a default value - leaving them blank causes the record selection formula to explode. The issue here is that the calendar tool picks up the default value instead of showing today's date.
I did more web surfing and found the answer on the Business Objects web site. The solution let me do what you suggested AND keep the Starting and Ending date parameters as Date types and defaulted to blank by making them optional parameters.
From the Business Objects web site (why isn't this stuff in the user's guide?):
2. Control over default values.
3. Request for an 'ALL' value.
Both of requirements 2 and 3 are met with the new optional parameter feature of CR 2008. When a parameter is flagged as 'optional', the report can execute without that value being set. The trick here is that any formula that attempts to reference an optional parameters that doesn't have a value set will return an error. So we've introduced the new HasValue() function which allows you to check and see if the parameter has a value.
This is really powerful, because now you can reference your parameters indirectly through another formula (or custom function) that checks if the parameter has a value or not. If it does, then the formula returns the parameter value. If it doesn't, then it can return whatever default value you wish. So if you want the default to be the day before, or last Friday, then you can code that logic into your formula that uses HasValue to check if the parameter has a value set or not.
Optional parameters were also intended to solve the 'All' problem. Basically, you want a parameter to participate in a record selection formula only if it has a value. If it doesn't, then you want that filter to be disabled. By using optional parameters and HasValue() in your record selection (and new saved data section) formulas, you can include conditions in your filter only if the parameters in those conditions have a value. -
Defining Date Parameter In Crystal XI R2
Hi,
I have a simple Crystal report using basic select query from Oracle DB. I have added date prompts start date and end date for users to provide date range.
Date parameters are defined as : Type - Date, Static LOV
Allow custom values - true
Allow multile values - false
Allow discrete values - true
My problem is when I run the report
1) the date prompt asks the user to enter the format in which they want to enter date.. which appears as drop down box with only one option mm/dd/yyyy --- I dont want this to appear at all
To enter value Calendar appears which is ok with me.
2) If I change
Allow custom values - false
the prompt to enter format of date doesnot appear, however the prompt to enter date value has drop down list..with no calendar to it.
Please help!Hi,
The 'Allow Custom Values' option for a date parameter is set to true by default and cannot be changed unless a 'Value Field' has been set to load the date values from the database.
You've also mentioned that the date prompt has an associated List of Values? If this is true, then this is how Crystal behaves!
Once the 'Allow Custom Values' option has been set to false, it means the only option the user is left with, is to select one or more values from the drop-down. Another important thing is that, you cannot set the 'Allow Custom Values' to true and have the date prompt (With an associated LOV) appear ONLY with the Calendar button.
If all that you want is the Calendar button with no drop-down containing date values, just select 'None' in the 'Value Field' of the date parameter.
Have a great day!
-Abhilash -
The book "OCA Oracle Database 11g SQL Fundamentals I Exam Guide (Exam 1Z0-051)" says
select employee_id, start_date from job_history;in HR schema will yield
101 21/SEP/89 00:00:00
101 28/OCT/93 00:00:00
102 13/JAN/93 00:00:00
114 24/MAR/98 00:00:00
122 01/JAN/99 00:00:00
176 24/MAR/98 00:00:00
176 01/JAN/99 00:00:00
200 17/SEP/87 00:00:00
200 01/JUL/94 00:00:00
201 17/FEB/96 00:00:00but I get
101 21-SEP-89
101 28-OCT-93
102 13-JAN-93
114 24-MAR-98
122 01-JAN-99
176 24-MAR-98
176 01-JAN-99
200 17-SEP-87
200 01-JUL-94
201 17-FEB-96Does it depend on any other factors or parameters or flags? Please clarify. I am using Oracle 11g and the exam guide is also for 11g.Hi It depends upon the NLS_DATE_FORMAT parameter value
it may be different
for me its
SQL> SELECT value FROM v$nls_parameters WHERE parameter ='NLS_DATE_FORMAT';
VALUE
DD-MON-RRDD-MON-YYYY is the default date format given by oralce if you want to change it use
SQL> alter session set NLS_DATE_FORMAT='YOUR FORMAT'Edited by: Qwerty on Aug 17, 2009 12:41 PM
Maybe you are looking for
-
General questions on IDOCs and IDOCs for 2 Accounting Interface BAPIs
This post involves several questions pertaining to the topic of IDOC creation. I downloaded a couple of PDFs and tried googling for material on that, but things are far from being clear in my mind. I tried to put my questions in some order, so we can
-
Calling BAPI_PO_CHANGE in a loop, correct POs after faulty PO erroring out
Hello Gurus! I have an issue while calling BAPI_PO_CHANGE. I'm looping on BAPI_PO_CHANGE with Purchase Orders one by one, and adding articles to the existing POs. It works fine if additional articles are correct The issue is, if one PO returns with e
-
Adding iMac Bondi Rev B to AirPort network
Ok, I have an AirPort network set up at my house that uses an AirPort Extreme (g) Base Station (AEBS) to connect to the internet. I can use that connection by using wifi connections from my iMac G4 (10.3.9), iMac G5 (10.4.10), PowerBook (10.4.10), an
-
Hi all, I've seen a few examples of creating Pick Lists through the DI, and I can't understand why my version won't work... If anyone can notice anything obvious and point it out to me that would be of great help! Using SAPB1 v9 PL10. MSSQL 2012. BoO
-
Is there a good free qraphic equalizer that works well with iTunes?
Is there a good free graphic equalizer that works well with iTunes?