0

Working with events, I need to get the next 5 events that are not expired, to do a sort of news tiker. So I tried to apply the following filter in visual query https://snag.gy/e1nWpD.jpg

It is getting even the expired events. Tryed also without the .ToString("yyyy-MM-dd") with no luck. It is possible to do this in visual query or the only solution is doing this with LINQ? I would not like doing this with LINQ cause I would have to get all event elements in query and then filter them taking just 5 and it would be a leak about performance...

EDIT: having a look at this http://2sxc.org/en/Docs/Feature/feature/9259 I tryed the following filter

Data > [DateTime:Now]

but my element with the date "Data": "2016-10-03T00:00:00Z" is always getting out from the query. Maybe a date culture issue?

1 Answers1

1

it's possible that it's a culture issue, but it's not likely.

Please run a few more tests using real text-values (so not a token) to compare the result with a real value and then with the token. This would help you rule out the culture issue.

Very often it's also a simple mistake like that you may be comparing "data" when your field is "date" or something.

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • Following your suggest, I just tried to compare my "Data" field (datetime) with a real value "2016-10-05" so my sample element with the date "Data": "2016-10-03T00:00:00Z" does not show correctly. Using the [DateTime:Now] token it is showing. So maybe it could be a culture option, cause the token used in a app page is going to show me the date in the european format dd/mm/yyyy. If it is a culture issue how can I fix it? I already tried to enable in the global app setting the culture option but does not make differences. – Giovanni Manzo Nov 02 '16 at 10:11
  • Could you help me be sure I understand you. You tested it with a text like "2016-01-03" and it didn't show - so you assume the filter worked as expected. Then you took another date where it did show, so again as expected. Then you tried the token, and it didn't work as expected. Correct? – iJungleBoy Nov 02 '16 at 11:33
  • Yes, correct! My element date value is "2016-10-03", if I use a comparer where my date > of a text "2016-10-01" it does show. Using a comprare where my date > of a text "2016-10-05" it does not show. Using the [DateTime:Now] token it does show, even if it would not! Maybe it is cause my datetime.now based on my culture settings should be 02/11/2016... – Giovanni Manzo Nov 02 '16 at 12:53
  • I'm not 100% sure but you may be able to work with formaters - like [DateTime:Now|yyyy-MM-dd] http://www.dnnsoftware.com/wiki/tokens - I can't promise that it works, but I think it should... – iJungleBoy Nov 06 '16 at 19:40
  • Unfortunatly I already tryed that but does not work, any chance to add this as a next feature? :) – Giovanni Manzo Nov 06 '16 at 21:40
  • not sure yet - but as a fallback you could provide the date in the url when querying, not nice bet should work. Changes to 2sxc - we love contributions :) – iJungleBoy Nov 08 '16 at 14:05
  • Thanks you. I don't like very much passing the date as querystring. I think the best way right now is to use LINQ. About the changes in 2sxc and contributions I would like to, using 2sxc is so funny and useful, but I would need a depth session of study to avoid mess up the code ;) – Giovanni Manzo Nov 08 '16 at 15:07