Showing posts with label calculate. Show all posts
Showing posts with label calculate. Show all posts

Thursday, March 22, 2012

Comparing Dates in Previous and Current Rows

Dear All,
I am having textboxes on two detail rows (as an example), I want to calculate the date difference between two textbox date values. The date difference is between the previous row and the current row. As an example:

A B
5/2/2005 09:39:02 AM5/3/2005 06:29:32 PM
5/4/2005 08:21:31 AM5/5/2005 07:02:29 PM
5/6/2005 09:52:33 AM5/6/2005 07:04:31 PM
5/7/2005 09:20:33 AM5/8/2005 08:26:36 AM

I want to do A2-B1 in the report. I need to calculate the date difference between 5/4/2005 8:21:31 AM and 5/3/2005 6:29:32 PM as an example. The same thing for A3 and B2. ...
Do you have any idea how I can achieve this? Is there a way to do that? Do I need some special code to accomplish this?
Thank you for your help.
BTHi,
a way is to create a store proc that make the calculation
(fetching results in a temp table).|||
yes you can
you can use formula like this
=ReportItems!A.Value.Subtract(ReportItems!B.Value)
where A and B are the name of the cells in your table
noteSubtractfunction in datetime returns timespan|||

Hi,
IMHO the formula
ReportItems!A.Value.Subtract(ReportItems!B.Value)
calculate difference between value of the same row.
I've understood that Salmiya have to calculate between a value of column A with
value of column B, but of previous row.

|||Yes you are right. I have to compare previous row with current one.
Thank you.|||tblDates :
PK A B
----------------
1 5/2/2005 09:39:02 AM 5/3/2005 06:29:32 PM
2 5/4/2005 08:21:31 AM 5/5/2005 07:02:29 PM
3 5/6/2005 09:52:33 AM 5/6/2005 07:04:31 PM
4 5/7/2005 09:20:33 AM 5/8/2005 08:26:36 AM

You can do :
Select [Difference] = A-IsNull((Select B from tblDates where PK=2 ),0) from tblDates where PK=3
HTH,
Best Regards,
Hemchand|||Hi.....
U can use =ReportItems!textbox1.Value - ReportItems!textbox2.Value
Then U will get it..........
Best Regards....

Wednesday, March 7, 2012

Compare 2 DB

Hi,
I need to compare 2 DB (Tables, Colums etc) in order two calculate/determine
the difference between both, does somebody knows an aplication which is able
to do this? It would be great if this aplication would also be able to
create a script, after comparison, which aplies to one of the DB what the
other has differente/more. I hope I made understand myself!! :-) If the
aplication is able to compare two Tables would be enough.
I apreciate any help, thanks.
Marcelo
SQLCompare from www.red-gate.com is the tool I use for that.
Jacco Schalkwijk
SQL Server MVP
"Marcelo Moreira" <marcelo.moreira@.vpconsulting.pt> wrote in message
news:eoh%234BEYFHA.252@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to compare 2 DB (Tables, Colums etc) in order two
> calculate/determine the difference between both, does somebody knows an
> aplication which is able to do this? It would be great if this aplication
> would also be able to create a script, after comparison, which aplies to
> one of the DB what the other has differente/more. I hope I made understand
> myself!! :-) If the aplication is able to compare two Tables would be
> enough.
> I apreciate any help, thanks.
> Marcelo
>

Compare 2 DB

Hi,
I need to compare 2 DB (Tables, Colums etc) in order two calculate/determine
the difference between both, does somebody knows an aplication which is able
to do this? It would be great if this aplication would also be able to
create a script, after comparison, which aplies to one of the DB what the
other has differente/more. I hope I made understand myself!! :-) If the
aplication is able to compare two Tables would be enough.
I apreciate any help, thanks.
MarceloSQLCompare from www.red-gate.com is the tool I use for that.
Jacco Schalkwijk
SQL Server MVP
"Marcelo Moreira" <marcelo.moreira@.vpconsulting.pt> wrote in message
news:eoh%234BEYFHA.252@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I need to compare 2 DB (Tables, Colums etc) in order two
> calculate/determine the difference between both, does somebody knows an
> aplication which is able to do this? It would be great if this aplication
> would also be able to create a script, after comparison, which aplies to
> one of the DB what the other has differente/more. I hope I made understand
> myself!! :-) If the aplication is able to compare two Tables would be
> enough.
> I apreciate any help, thanks.
> Marcelo
>