Filtering a dataset to weekday

CMS Version

2.1.0

Player Type

Linux player

Issue

I have created a dataset with 6 columns, one of them is ‘Day’ , a list of strings (Sun,Mon,Tue etc.)

The dataset is kind of weekly schedule, so I created it as a list of strings so it will be easier for the user to fill the data in the dataset by selecting the date from the dropdown when filling manually.

In the layout , I have added a region with DataSetView, I would like to filter only the records from the dataset that include the current day of the week.

I have tried several ways to filter the dataset, like:
Day = DATE_FORMAT(CURDATE(),’%D’)
Day = DATENAME(weekday, DATE())
Day = DAYNAME(NOW())
but none returns data / the desired result.

(I guess you see I’m confused and not sure what path to go with SQL, although I know that the DB behind the CMS is MySQL)

What am I missing?
I have come to understand that the syntax is right, since I get the “No Data returned…” message, while when there is a syntax error, no message appears on the region,
but still I cannot seem to get the filtered data displayed.

Any help would be greatly appreciated.
Guy

OK,
I did it (it happens to me sometime when I write a question…lol)
I imagined that my problem could be with the fact that the date I input to the dataset is actually a string.

So, while waiting for answer, I have decided to actually convert my answer from the DATE_FORMAT to CHAR, and it did the trick…

Day = CONVERT(DATE_FORMAT(CURDATE(), “%W”), CHAR)

This is how I solved it on my side, according to the rules I created myself.

Hope this will help someone.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.