Showing posts with label begindate. Show all posts
Showing posts with label begindate. Show all posts

Thursday, March 22, 2012

date parameter in textbox

Hello,
I have two parameter one for Begindate and EndDate.
I was wondering how I can reference these two parameters so that it shows up
in a textbox.
I was hoping to have the textbox with the begin date and end date so that
when users print out the report they know that it is between those two
dates.
TIA,
JacksonHello:
I have done the following and I am not sure if thi8s method is for you or
not - but:
I included an additional line in my detail headers - that reference the
parameters passed for execution of the application.
You can define within the text boxes - the !Parameters passed - and define
as a field element - but just for the headings
Not sure if I was clear enough -
Warm regards,
"Jackson" wrote:
> Hello,
> I have two parameter one for Begindate and EndDate.
> I was wondering how I can reference these two parameters so that it shows up
> in a textbox.
> I was hoping to have the textbox with the begin date and end date so that
> when users print out the report they know that it is between those two
> dates.
> TIA,
> Jackson
>
>|||Thanks for replying back so fast.
Do you have the syntax for referencing the parameters?
If I had an parameter called begindate. would I type
Parameters!begindate.value or something like that?
Thanks again for the help,
Jackson
"code_slayer_bkk" <codeslayerbkk@.discussions.microsoft.com> wrote in message
news:7E9B23DD-D7BB-4077-A760-12BB61B549F0@.microsoft.com...
> Hello:
> I have done the following and I am not sure if thi8s method is for you or
> not - but:
> I included an additional line in my detail headers - that reference the
> parameters passed for execution of the application.
> You can define within the text boxes - the !Parameters passed - and define
> as a field element - but just for the headings
> Not sure if I was clear enough -
> Warm regards,
> "Jackson" wrote:
>> Hello,
>> I have two parameter one for Begindate and EndDate.
>> I was wondering how I can reference these two parameters so that it shows
>> up
>> in a textbox.
>> I was hoping to have the textbox with the begin date and end date so that
>> when users print out the report they know that it is between those two
>> dates.
>> TIA,
>> Jackson
>>|||Yes, that is how you would do it. But I suggest instead of typing you use
the expression editor. Right click on the textbox (or cell), select
Expression. You will be able to select the parameter you want to show. Note
that the name of your parameter is case sensitive. Also, sometimes you might
want the lable, not the value. If so then replace .value with .label (label
is not a choice with the expression builder).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Jackson" <jackson_num5@.yahoo.com> wrote in message
news:urcnkbYZGHA.504@.TK2MSFTNGP03.phx.gbl...
> Thanks for replying back so fast.
> Do you have the syntax for referencing the parameters?
> If I had an parameter called begindate. would I type
> Parameters!begindate.value or something like that?
> Thanks again for the help,
> Jackson
> "code_slayer_bkk" <codeslayerbkk@.discussions.microsoft.com> wrote in
> message news:7E9B23DD-D7BB-4077-A760-12BB61B549F0@.microsoft.com...
>> Hello:
>> I have done the following and I am not sure if thi8s method is for you or
>> not - but:
>> I included an additional line in my detail headers - that reference the
>> parameters passed for execution of the application.
>> You can define within the text boxes - the !Parameters passed - and
>> define
>> as a field element - but just for the headings
>> Not sure if I was clear enough -
>> Warm regards,
>> "Jackson" wrote:
>> Hello,
>> I have two parameter one for Begindate and EndDate.
>> I was wondering how I can reference these two parameters so that it
>> shows up
>> in a textbox.
>> I was hoping to have the textbox with the begin date and end date so
>> that
>> when users print out the report they know that it is between those two
>> dates.
>> TIA,
>> Jackson
>>
>|||Try this. = "Begin Date " & Parameters!Begindate.Value
"Jackson" wrote:
> Hello,
> I have two parameter one for Begindate and EndDate.
> I was wondering how I can reference these two parameters so that it shows up
> in a textbox.
> I was hoping to have the textbox with the begin date and end date so that
> when users print out the report they know that it is between those two
> dates.
> TIA,
> Jackson
>
>

Date Parameter in Reports Manager

I have one master report and 4 linked reports. I deployed a report and set defaults for BeginDate and EndDate as =Today(). I have 4 linked reports that I need to change the date parameters for each. For instance the first linked reports needs to be BeginDate =Today() and the EndDate as =Today()+30. So in my linked report, I tried to change the EndDate to =Today()+30 and an error, 'The value provided for the report parameter 'BeginDate' is not valid for its type.'

So I can't put =Today() or =Today()+30 in the parameters once I override the defaults. Can someone tell me what I'm missing here?

Thanks, Iris

Not sure if this will help but,

Try this:

=DateSerial(Year(Now), Month(Now), Day(Now)+30)

Instead of: Today()+30

|||I still got the same error. When I click 'override default' and put in the expression and click apply, I get this error.|||

When you say you have one master report and four linked reports. What does that mean?

The only way I can help you is to understand what your saying. Are you linking from within the master report by setting up four links using text boxes? Are you displaying data in a table and upon clicking on a field you are using the jump to report? What are your parameters initial settings for the StartDate and EndDate . ie(DateTime, String, etc...) I'm not sure just exactly what it is that your doing. If your attempting to pass a parameter value to a sub-report and change the default value, or setting up a subscription and over-riding the default value. Please explain further and I'll try to provide an answer.

|||

I've decided to use 'Available Values' in the Report Parameters area instead. Someone else tested and got the same error I did.

But basically, my idea came from an article located at www.databasejournal.com/features/mssql/article.php/3613751

Thanks,

Iris

Date Parameter in Reports Manager

I have one master report and 4 linked reports. I deployed a report and set defaults for BeginDate and EndDate as =Today(). I have 4 linked reports that I need to change the date parameters for each. For instance the first linked reports needs to be BeginDate =Today() and the EndDate as =Today()+30. So in my linked report, I tried to change the EndDate to =Today()+30 and an error, 'The value provided for the report parameter 'BeginDate' is not valid for its type.'

So I can't put =Today() or =Today()+30 in the parameters once I override the defaults. Can someone tell me what I'm missing here?

Thanks, Iris

Not sure if this will help but,

Try this:

=DateSerial(Year(Now), Month(Now), Day(Now)+30)

Instead of: Today()+30

|||I still got the same error. When I click 'override default' and put in the expression and click apply, I get this error.|||

When you say you have one master report and four linked reports. What does that mean?

The only way I can help you is to understand what your saying. Are you linking from within the master report by setting up four links using text boxes? Are you displaying data in a table and upon clicking on a field you are using the jump to report? What are your parameters initial settings for the StartDate and EndDate . ie(DateTime, String, etc...) I'm not sure just exactly what it is that your doing. If your attempting to pass a parameter value to a sub-report and change the default value, or setting up a subscription and over-riding the default value. Please explain further and I'll try to provide an answer.

|||

I've decided to use 'Available Values' in the Report Parameters area instead. Someone else tested and got the same error I did.

But basically, my idea came from an article located at www.databasejournal.com/features/mssql/article.php/3613751

Thanks,

Iris

Wednesday, March 7, 2012

Date Format

Will the following statement give me the date in the format of dd/mm/yyyy?
Set @.begindate = Convert(Datetime, @.begindate, 103)Also is it possible to do a search of a range on a field that is defined as
varchar. Example: data is imported into a table from a text file. The data
contains the date of when a project finished. The date is imported as
varchar. I need to know the projects that finished in a given w. The date
string is imported with the format dd/mm/yyyy.
Create Table Project
(ProjectID int Primary Key,
DateStart Varchar(10),
DateStop Varchar(10),
ProjectLeadID
)
Select *
From Project
Where DateStart >= 'date'
And DateStop <= 'another date'
"A.B." wrote:

> Will the following statement give me the date in the format of dd/mm/yyyy?
> Set @.begindate = Convert(Datetime, @.begindate, 103)|||A.B.,
SQL Server does not store datetime values in a specific format. See
"datetime and smalldatetime" in BOL for more info.
AMB
"A.B." wrote:

> Will the following statement give me the date in the format of dd/mm/yyyy?
> Set @.begindate = Convert(Datetime, @.begindate, 103)|||Try,
declare @.sd datetime
declare @.ed datetime
set @.sd = '20050101'
set @.ed = '20050908'
Select *
From Project
Where
right(DateStart, 4) + substring(DateStart, 4, 2) + left(DateStart, 2) >=
@.sd
And right(DateStop, 4) + substring(DateStop, 4, 2) + left(DateStop, 2) <
dateadd(day, 1, @.ed)
Do not expect that sql server perform an index s if there is a index by
DateStart and / or DateStop.
AMB
"A.B." wrote:
> Also is it possible to do a search of a range on a field that is defined a
s
> varchar. Example: data is imported into a table from a text file. The data
> contains the date of when a project finished. The date is imported as
> varchar. I need to know the projects that finished in a given w. The da
te
> string is imported with the format dd/mm/yyyy.
> Create Table Project
> (ProjectID int Primary Key,
> DateStart Varchar(10),
> DateStop Varchar(10),
> ProjectLeadID
> )
> Select *
> From Project
> Where DateStart >= 'date'
> And DateStop <= 'another date'
> "A.B." wrote:
>|||I believe what you're looking for is:
Set @.begindate = Convert(varchar, @.begindate, 103)
"A.B." wrote:

> Will the following statement give me the date in the format of dd/mm/yyyy?
> Set @.begindate = Convert(Datetime, @.begindate, 103)|||In order to search on a range of dates, you'll need to convert the varchar
columns to datetime. Something like this:
Select *
From Project
Where convert(datetime, DateStart) >= 'date'
And convert(datetime, DateStop) <= 'another date'
"A.B." wrote:
> Also is it possible to do a search of a range on a field that is defined a
s
> varchar. Example: data is imported into a table from a text file. The data
> contains the date of when a project finished. The date is imported as
> varchar. I need to know the projects that finished in a given w. The da
te
> string is imported with the format dd/mm/yyyy.
> Create Table Project
> (ProjectID int Primary Key,
> DateStart Varchar(10),
> DateStop Varchar(10),
> ProjectLeadID
> )
> Select *
> From Project
> Where DateStart >= 'date'
> And DateStop <= 'another date'
> "A.B." wrote:
>|||I am using the statement to set a variable later in my query I am going to
use the variable to pass that date to a SP that I wrote. But I need to the
format of the date to be dd/mm/yyyy.
Alter Procedure ButtonPushesRan
@.begindate VarChar(11),
@.enddate VarChar(11)
AS
Set @.begindate = Convert(Datetime, @.begindate, 103)
Set @.enddate = Convert(Datetime, @.enddate, 103)
SELECT DISTINCT TOP 100 PERCENT LotID, TDateStop
FROM dbo.LotInfoData
WHERE TDateStop <= @.begindate
or TDateStop >= @.endDate
ORDER BY LotID
"Alejandro Mesa" wrote:
> A.B.,
> SQL Server does not store datetime values in a specific format. See
> "datetime and smalldatetime" in BOL for more info.
>
> AMB
> "A.B." wrote:
>|||On Thu, 8 Sep 2005 07:06:24 -0700, A.B. wrote:

>Also is it possible to do a search of a range on a field that is defined as
>varchar. Example: data is imported into a table from a text file. The data
>contains the date of when a project finished. The date is imported as
>varchar. I need to know the projects that finished in a given w. The dat
e
>string is imported with the format dd/mm/yyyy.
>Create Table Project
>(ProjectID int Primary Key,
>DateStart Varchar(10),
>DateStop Varchar(10),
>ProjectLeadID
> )
(snip)
Hi A.B.,
Make sure you check the validity of the date when doing the import. Than
convert it to datetime format. That will make all queries on your dates
lots easier.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||On Thu, 8 Sep 2005 07:56:04 -0700, A.B. wrote:

>I am using the statement to set a variable later in my query I am going to
>use the variable to pass that date to a SP that I wrote. But I need to the
>format of the date to be dd/mm/yyyy.
>Alter Procedure ButtonPushesRan
>@.begindate VarChar(11),
>@.enddate VarChar(11)
>AS
>Set @.begindate = Convert(Datetime, @.begindate, 103)
>Set @.enddate = Convert(Datetime, @.enddate, 103)
>SELECT DISTINCT TOP 100 PERCENT LotID, TDateStop
>FROM dbo.LotInfoData
>WHERE TDateStop <= @.begindate
> or TDateStop >= @.endDate
>ORDER BY LotID
Hi A.B.,
If both the TDateStop column and your variable are defined as varchar,
you'll be doing string comparisons. That means that '01/09/2006' will be
considered to be less than '31/08/2005'. I doubt that is what you want
to achieve. As I said in my other post - convert the imported data to
datetime and store it as such.
Also, remove the TOP 100 PERCENT from the SELECT statement - a SELECT
statement will return all rows by default.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)