I'm working with loopback , but now i want to perform some operation on my data after a certain time automaticaly
Precioulsly I have a model called Canal and my model has a field beginDate and endDate of type Date, beginDateis set to today date , and endDateis set to beginDateplus two dates , so I want to delete Canal whom endDate is expired
Any ideas how to process ?
You can use node-schedule to add something like a cron job and run it in specific time each day and delete expired Canals.
You should define it as a boot script in LoopBack.
Related
Build a report having below requirement:
Fields:
EmployeeID
Worker
Primary Position
Business Title
Location
Username
Hire Date
Original Hire Date
Termination Date
Hire BP Completion Date
Termination BP Completion Date
Selection Criteria:
Worker must be either active or on leave or (termination date within last 30 days)
Build above report and let me know once it's done
We have created alerts (for reports without input variables, like stock report) in metabase and are working fine.
We have created sales reports for client which is based on date range.
Now client ask for alerts on sales reports on daily basis, that means, default value for From & To date should be Today's date.
We have set alerts but not getting in our mailbox.
Can you please let me know how can i achieve this?
Today's date as default value in input variable
Get report in my inbox every morning.
I have removed variables and used cast(now() as date) to get data for current date and alert was set at EOD, so it is working as expected.
After doing this when i set alerts, i got report in my inbox at scheduled time.
I'm creating my portfolio with Symfony 3 and I want to show my skills with my experience.
I have a "Skill" entity with a "startAt" param (type=datetime) and a "exp" param (string).
The "exp" param = the difference between "startAt" and the current date.
I add some lifecycle callback so the "exp" param update every time I touch my "Skill" entity but here is my question:
How can I update my entity every day without touching it?
For exemple right now I have "exp = 6 months" but next month this param need to be "7 months".
Since "startAt" is likely mapped to a field name in the database called "start_at", this date is all the data you need to set and store. The method in the entity called getExp(), which maps to the variable "exp" would then take $this->startAt() value and calculate the difference between that start at time and the current time. You can use the PHP DateTime object to calculate the difference in units of days, months or years, depending on your preference.
Also, "exp" doesn't need to be a field you need to store or map to the database because it can easily be calculated on the fly based on the "startAt" date value anyway.
create a command that update your entity and make a cron tab with it
I will be entering some values into a database based on input from users. One value will be the date and time of the input.
I'm not sure how this works at all, but a user from e.g. New York enters some data and the website is hosted in the UK...what time will be stored?
Up until now I had been using the "now()" function to record the date and time, but just occured to me that this could happen! What else should I use?
Thanks,
UTC, works in any time zone, you can either save all dates in your storage as UTC or use proper type that includes time zone data, for example in SQL 2008 you can use datetimeoffset
I have a table, named ReportingPeriods, that I want to be populated entirely automatically. In another table, there are attributes CreationDate and ReportingPeriodLength which together will determine the the results of this row. Upon adding a row for this table, we will add a row in ReportingPeriods with the first StartDate as the creation date and EndDate as ReportingPeriodLength days after startDate.
So far, this is simple. However, I wish to check (daily) whether this period has expired. And if it has, I want to start a new row, beginning the day after the EndDate and extending, once again, for ReportingPeriodLength days.
Is this possible to accomplish without manually checking and adding a new row?
Thanks :)
call a stored procedure from a database job that is run each day. within this procedure, do your check and insert if necessary.
Windows Scheduled Tasks is an appropriate tool for this.
You can write a simple script or a C# console application that calls a stored procedure in your database. Add that executable as the command for a new scheduled task and pick an appropriate time.