Using EndOfCurrent dates for visibility expression

When I tried to compare a date to [%EndOfCurrentDay%] or [%EndOfCurrentweek%] in a visibility expression it failed to evaluate and only logged error in browser. I'm using the expression $date > or < [%EndOfCurrentweek/day%], any ideas?   Error from browser console:   Uncaught (in promise) Error: mxui_widget_DataView_187.applyContext: Error: Operator > not supported in expression >(, Sat Nov 03 2018 23:59:59 GMT-0700 (Pacific Daylight Time))     at mxui.js?636765920735742991:1     at Object.e.exports.collect (mxui.js?636765920735742991:1)     at Object.e.exports.applyContext (mxui.js?636765920735742991:1)     at O.(:8080/anonymous function).E.passContext (http://localhost:8080/mxclientsystem/mxui/mxui.js?636765920735742991:1:148381)     at O.(:8080/anonymous function).E.applyContext (http://localhost:8080/mxclientsystem/mxui/mxui.js?636765920735742991:1:148266)     at O.(:8080/anonymous function).E.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?636765920735742991:1:497821)     at Object.e.exports.collect (mxui.js?636765920735742991:1)     at O.(:8080/anonymous function).E.collect (http://localhost:8080/mxclientsystem/mxui/mxui.js?636765920735742991:1:149167)     at O.(:8080/anonymous function).E._loadListItems (http://localhost:8080/mxclientsystem/mxui/mxui.js?636765920735742991:1:497664)     at mxui.js?636765920735742991:1
2 answers

I tested it in 7.13.1 in a simple setup with an Overview and NewEdit page. When creating a new object, I get the same error. When editing an object with a date, it works as you'd expect when I change the date.

Therefor Maarten is right: your attribute value is empty. You could change the condition to:

$currentObject/Date != empty
$currentObject/Date > [%EndOfCurrentWeek%]

or in case you want to show it when there's no value:

$currentObject/Date = empty
$currentObject/Date > [%EndOfCurrentWeek%]

This way the first part already determines the visibility before it gives the error.


I have tried this is Mx  7.16 but it works there, the expression i used looks as follows:

$currentObject/date < [%EndOfCurrentWeek%]

Is it possible your object date value is empty? Otherwise maybe try and upgrade your Mx version?