Finding difference b/w values stored in same database field

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
JB429
Posts: 3
Joined: Tue Oct 10, 2017 12:44 pm

Finding difference b/w values stored in same database field

Post by JB429 » Fri Jul 06, 2012 9:54 am

I need to create an expression to find the difference between two time values which are stored in the same field in a database table but different record lines. There are two records which represent the same transaction at two different points in time, and I need to know how long it took to get from point A to B.____Can someone help? Thanks!

User avatar
cstrasser
Posts: 155
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: Finding difference b/w values stored in same database field

Post by cstrasser » Thu Jul 19, 2012 4:36 pm

If you can sort the transactions so that they are in order and stacked sequentially, you can make use of the PREVIOUS() function in R&R.____For instance, say there are three records for a given customer in a table and there is a calculated field called PrevTranDt defined as PREVIOUS(TRANSDATE). You^d see:____COMPANY TRANSDATE TRANSAMT TRANSCT PrevTranDt__HEWPAK 01/18/2012 50.00 CHG *****__HEWPAK 02/21/2012 50.00 PMT 01/18/2012__MICSOF 03/15/2012 100.00 CHG 02/21/2012____You^d be able to use PrevTranDt and TRANSDATE together in a calculation to find that there were 34 days between the transactions. You^d have to handle the situations where the first record is undefined (i.e. the asterisks) as well as when the customer changes in this case and not compute the difference between unlike entries.__
Chris Strasser
Liveware Publishing, Inc.
Work bigger.

Post Reply