How to calculate one hour from creation date/time?

Hi,
I am trying to create a workflow wherein once a request is placed the same request does not get placed for the next one hour, and after one hour the previous workflow gets canceled, so that request for same service can be placed again. (This is to avoid duplication of requests)

image

This expression seems to work but I can not define a timeline here.
The option of (+hours) is not available in ‘Do a search for’ , it is available with Current date/time but then a (-hours) option is not available with it.
Can someone suggest a way out?

This is one of those order of operations things I’m guessing. If you can’t reorder your expression so that u can do +hour off the first thing, just insert a workflow step before this and shove your_date_thing+(hours)1 into a custom state.

Then use that variable in your expression.

Hi @louisadekoya,
Can the Relative Time with Moment.js plugin be used in my case scenario?
Can you help me understand how to implement it in scenario mentioned above?
Actually I want to show a popup to the user that the request has already been received and he should wait 45-60 minutes before making a new request.

image

This is what I am trying to do.

image

Hi @Ankur,

The plugin isn’t really designed for this use case and unless I have misunderstood you, I don’t think you need it for what you’re trying to do. You should be able to simply use current date/time. So your condition would be Only when … Current date/time - Search for Jobs’ last item’s creation date:formatted as minutes < 60

Please see this link for an example. I modified an existing page to only allow a new goal to be added if the last one was added more than a minute ago. Check out the conditions on the button click events.

You may alternatively want to disable the button until after the time delay. See the discussion here for that.

I hope this helps.

Hey @louisadekoya,
This solution of using the current date/time- thing was starring upright in my face for all these days but did not enter my dumb-wit mind :thinking: Moreover I have used this expression in this same app at a different place and was still struggling for past 2 days.

“The greatest reason for stress is our dumbness to choose one thought over another.”
Thanks for your help.

I want to ask you another question which arose after looking into the deactivate button discussion.
I was using a countdown timer made by @NigelG for calculating the time difference between a job start time and end time. But I realized later that if the page got refreshed during the tenor the timer would start from zero, so I decided to use the database for the purpose and that solved the issue.
My question is, will using the database for this have any negative impact if the timer was to run for a long time (Say couple of hours per event) and will it work for multiple users engaged at the same time?

I’m not familiar with this specific timer. Will its value be saved to the current user? If so then I don’t see any risk of conflict between multiple users updating the database value. If your concern is more about performance, then I think it will be a good problem to have - lots of concurrent users in your app, which you can solve if and when it becomes an actual issue. In other words, cross that bridge when you come to it. Otherwise, maybe you can do a test with 10 or more incognito browser sessions and see the impact. I found the site LoadView Pricing | Subscription & On-Demand Load Testing Plans which you can also try.

Thanks for the insight, I’ll definitely give it a try.
The timer is getting saved to every new job created, and every time the created job has a unique id so I hope it doesn’t conflict.
I am keeping my fingers crossed for the performance.
Thanks again.

This topic was automatically closed after 70 days. New replies are no longer allowed.