Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

Help with Find query

$
0
0

Hello,

I have a page type that stores users birthday in mm/dd format as a string. There is no year.

I have a requirement to show the pages of the users who have their birthday today. I was wondering how would I go query for this since the stored birthday is not in Datetime format how can I split the value and match month and day with todays month and day.

I tried this but I cant get any match.

var query = _client.Search<IContent>();
var toSearch = DateTime.Today.Month.ToString("00") + "/" + DateTime.Today.Day.ToString("00");
var bdayFilter = _client.BuildFilter<PersonProfilePage>();
bdayFilter = bdayFilter.And(x => x.BirthDay.Match(toSearch));


var result = query
.Filter(x => x.MatchType(typeof(PersonProfilePage)))
.Filter(bdayFilter)
.Take(1000)
.GetContentResult();


Viewing all articles
Browse latest Browse all 8020

Trending Articles