DHTMLX Scheduler recurring year events - Problems with rec_type - dhtmlx

I'm trying to add a recurring event in my Database using dhtmlx scheduler. I'm using a full customized Lightbox with my own fields. Daily, weekly and monthly Events will be added perfectly to the database. Maybe i overlooked something
I've tried to save the exact rec_type like the monthly event, because they are using the nearly the same template, there is only one difference between them. I changed "month" into "year".
At the end, my entry looks like this:
{
end_date: "09.06.2026 12:00"
id: "a97ede9d-372f-4360-9fdb-e97e26aaacf8"
rec_type: "year_5_4_1#09/06/2026"
start_date: "05.09.2019 12:00"
text: "test12345"
}
I expect the output of all events on the first thursday in may until 2026. Maybe you can help me to find out, where the error is.

If recurring events start in May, the start_date also must contain May. I.e.
start_date: "05.05.2020 12:00"
The client side gets data from the rec_type field as a string of the following format:
[type]_[count]_[day]_[count2]_[days]#[extra]
where:
type - the type of repetition: 'day','week','month','year'.
count - the interval between events in the "type" units.
day and count2 - define a day of a month ( first Monday, third Friday, etc ).
days - a comma-separated list of affected week days.
extra - extra info that can be used to change the presentation of recurring details.
So, rec_type for each first Thursday in May must be:
rec_type: "year_1_4_1_"
Demo to check how it works.
If you need more details about rec_type property, please find them in docs.

Related

How can I filter a table for the field values on the last(highest) date in a custom four week period, using DAX in Power BI?

I created a calculated table based on start and end dates to check which manager is responsible for a product per date.
Result:
The financial department uses a four week period to report. So 13 periods per year.
(not usable in a date table?)
Product number 8098 gets a different manager on the 23rd of januari this year.
So at the start manager C5104 is responsible and at the end of period one (202301) C5107 is responsible.
To get one responsible manager per period I'd like to filter the table in such a fashion that I get the numbers from the last date in a period. After filtering I don't need the [date] field anymore.
I hope I'm just missing something basic like the 'ELLEXCEPT' But I'm lost...
DISTINCT gives:
One row too many. I'd like to lose the row: 8098, C5104, 202301.
To keep only rows showing the manager per product at the end of a period.

Add date filter list in Tableau

I have created time series dashboard where x-axis are week numbers (May4, 2020, etc.). The week number I have created from actual week number and year:
DATETRUNC('week',DATEPARSE("w-yyyy",STR([Week])+"-"+ STR([Year])))
Now I want to create a list filter, so I can only select one weeks from X week selected. Anyway, when I do it, it shows as "week 23", "week 24", etc.
Is there a way of actually showing as list of filters "May4, 2020", "May11, 2020", etc. instead?
This is how it shows now:
Doesn't using your calculated field
DATETRUNC('week',DATEPARSE("w-yyyy",STR([Week])+"-"+ STR([Year])))
as the filter field do this?
stupid thing. Only needed to change to discret the calculated value and done.

Can I generate the number of business days in a month in Visual Studio?

I have a report that takes sales data from a few tables. I want to add a field that will divide the total sales for the given month by the total number of business days in that same month. Is there a way I can calculate that in an expression? Do I need to create a new table in the database specifically for months and their number of business days? How should I go about this?
Thank you
Intuitively, I would say that you need a simple function and a table.
The table is to host the exceptions like Independence day, labor day, etc.
The function will get two parameters: Month and Year (I'm not providing any sample code since you haven't specified which language you are using).
It will then build a date as yyyy-mm-01 (meaning, first day of the month). If will then loop from 2 to 31 and:
Create a new date by adding the index of the loop to the initial date,
Check if the resulting date is still within the month,
Check if it is a working or not working day (e.g. Sunday),
Check if it is found within the table of exceptions.
If the created date passes all the above tests, you add 1 to the counter.
Though it might look complex, it is not and it will provide you the correct answer regardless of the month (e.g. Feb.) and the year (leap or not).

What's a good way to implement a date filter in a list where the items have different timezones?

We have an app that lists sport events. An event is associated to 2 teams (home team and away team). In the event list, we are showing the date of the event in the home team's timezone. We are storing dates in the database in UTC. We need to add a date filter in the event list page, but the problem is, since we are storing the date in our db in UTC and the dates in the event list is being shown in the home team's timezone, the date filter is showing unexpected results. the date is saved in our db as 2016-02-18 03:30:00+00 (UTC). When shown to the user in the event list it is 02/17/2016 7:30pm because the home team is in Pennsylvania and the timezone is America/New_York.
now when the date filter is set to 02/17/2016 by the user, we are querying the the db to fetch all events where the date is 02/17/2016. It will cause unexpected results since it will not match the event because in our db the date is 02/18/2016.
One solution I can think of is show 2 date & time columns in the event list.
Date (UTC) | Time (UTC) | Date (Home team's timezone) | Time (Home team's timezone)
And inform the user that when using the date filter it will filter the events using date (utc)
But we're currently looking for a better solution. Any help / suggestion would be greatly appreciated :)
EDIT:
event 1:
- date: 01/12/2016
- time: 9:00am
- home team's timezone: America/Chicago
event 2:
- date: 01/12/2016
- time: 9:00am
- home team's timezone: America/Denver
event 3:
- date: 01/12/2016
- time: 9:00am
- home team's timezone: Asia/Singapore
if the user selects 01/12/2016 in the date filter. It should still show the 3 events above.
Add a new field in the database which stores the dates in its local time and use that field to filter the results.
so when you filter say, 2016-04-01, it will actually be filtering things across different timezones i.e. events that are not at the same Epoch time
so show me all events for e.g. Thursday, regardless of where the teams are (meaning that one team’s thursday is another team’s friday)
it will filter results that are localised to wherever the date was stored from.
Another solution is to use on the fly conversion query.
Example:
where convert_to_local_without_timezone(event_datetime, event_tz) = date_filter
It can be a user defined function - http://www.postgresql.org/docs/8.0/static/xfunc.html if there's no existing function that can achieve this.
Credits to:
Aries, Ryan Johnson and Nikki Erwin Ramirez

RethinkDB: Can I group by day / week / month?

My table has a timestamp field, which is a standard RethinkDB date field.
Can I group rows by day / week / month using this timestamp field? Couldn't find any examples in the group() docs.
To group by month, day, or day of week individually:
r.table(...).group(r.row('timestamp').month())
r.table(...).group(r.row('timestamp').day())
r.table(...).group(r.row('timestamp').dayOfWeek())
Grouping by the week isn't as easy at the moment, because ReQL is currently missing a function to get the week number from a data (see https://github.com/rethinkdb/rethinkdb/issues/2055 ). You can probably work around that by using some custom JavaScript code through r.js(). Please let me know if this is important for you, so I can look into it.
If you want to group by combinations of multiple things, e.g. day and month:
r.table(...).group([r.row('timestamp').month(), r.row('timestamp').day()])

Resources