Jump to content
  • 0
Sherif

Time stamp duration between records in hrs

Question

Adding time stamp to each record 

Adding new record to ID 5 for example I Need calculated field in my report or  form  to calculate the time in hours between current  record and the previous record having the same ID.

 

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @Sherif,

Could you please elaborate your desired workflow? Initially, as I understand, you need to calculate the time in hours between the current and previous record with the same ID. Would you like to save it on your Table or just display it in a reports? 

You may refer to this article for reference in your Formula: https://howto.caspio.com/function-reference/

 

Regards,

kristina

Share this post


Link to post
Share on other sites
  • 0

Hello @Sherif

The formula should look something like this:

DATEDIFF(
  hh,
    (SELECT TOP 1 (Name_Of_Your_Date_Field)
    FROM Your_Table_Name
    WHERE Name_Of_ID_Field = target.[@field:Name_Of_ID_Field] 
    AND Name_Of_Your_Date_Field < target.[@field:Name_Of_Your_Date_Field]
    ORDER BY Name_Of_Your_Date_Field desc),
  target.[@field:Name_Of_Your_Date_Field]
)

This formula selects the last one entry with the same ID you have entered and return the difference in hours between submitted date and selected date.

Share this post


Link to post
Share on other sites
  • 0

Hello @Sherif

To implement such a formula you may use modulo division.


The formula should look something like this:
CAST( ((FULL_AMOUNT_OF_MINUTES  -  FULL_AMOUNT_OF_MINUTES % 60) / 60) AS NVARCHAR)  +  '.'  +  CAST( ((FULL_AMOUNT_OF_MINUTES % 60) * 100 / 60) AS NVARCHAR)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...