0

I have a column named Birthday and I have created a calculated calumn named BirthGET its formula is: =TEXT(Birthday,"dd/mm").for example a field in Birthday column would be 28/05/1998, now the value in BirthGET would be 28/05 this logic is working nice, but I have a problem.

I have added a content query web part, and I want to filter like this, if todays day and month is equal to BirthGET show that item.

enter image description here

How can I make this?

  • Just to veify, I presume you want the CQWP because you are querying Multiple Lists and/or want to display the results on another Site? If not it is easier to do this in a regular List View (but that would be a View on One List on the Same Site) – Danny '365CSI' Engelman May 6 '16 at 19:04
1

It should look something like this:

[Birthday] is equal to DATE(YEAR([Birthday]),MONTH([TODAY],DAY([TODAY]))
  • I am getting the following error: Please specify one of the following [PageFieldValue: (field name)] or [PageQueryString: (query string parameter name)] or an integer value for setting up a dynamic date range for date fields. – Nderon Hyseni May 6 '16 at 14:06
  • Another option would be to have calculated fields "BirthdayMonth" and "BirthdayDay" and then specify two filter rules – Gintas K May 6 '16 at 14:08
  • @NderonHyseni take a look at this: weblogs.asp.net/ricardoperes/… – Gintas K May 6 '16 at 14:10
1

You can't use the calculated field BirthGet for this purpose.

You should use a Date field and check if it equals [Today]

  • no this one will not work because I have only dd/mm and [Today] has dd/mm/yy and this is not working – Nderon Hyseni May 6 '16 at 13:41
  • Please read answer properly. You can't use calculated field in the filter because it is a Text and not date object – Amal Hashim May 6 '16 at 13:48
  • Thanks but what should I do in this case? – Nderon Hyseni May 6 '16 at 13:50
  • Use the date field. I know you derived BirthGet using a Date field. – Amal Hashim May 6 '16 at 13:51
  • Could you be more specific please? – Nderon Hyseni May 6 '16 at 13:52
1

You got two options :)

Either using a custom display template or using JSLink

Display Template:

I believe Birthday column has the year so the solution suggested by Patrick won't work! Honestly, Copy one of the existing display templates and apply that logic easily there and only display the desired result (parsing dates in javascript and doing date compare should be easy and lots of resources are out there on the web on how to do that). The solution is going to query the user profile for the Birthday field and do the calculation based on Today's date. If you dont have the user profile birthday property populated or not configured, you can tweak the solution to query the column you already has created.

https://joranmarkx.wordpress.com/2013/10/02/show-upcomming-birthdays-based-on-sharepoint-2013-user-profiles-with-search-office365/

or

http://www.lestersconyers.com/birthdays-and-anniversaries/

JSLink:

Create a custom function in the JSLink file that will query the ctx.CurrentItem.Birthday and compare it to current date var currentDate = new Date();( you need to parse the date using JavaScript and do the comparison) like this:

http://www.skylinetechnologies.com/Insights/Skyline-Blog/February-2015/Use-JS-Link-to-Create-a-Current-Birthdays-View

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.