Search code examples
datedatedifftibcospotfire

DateDiff error, "The expression is not complete"


In Spotfire I am using below expression using custom expression to make a horizontal line but I am getting error: "The expression is not complete". I am not able to figure out what the problem is.

DateDiff('dd',${startDate},${endDate})

Where startDate & endDate are document properties of "Date Time" type set to values "1/1/2013 12:00 AM" & "2/4/2013 12:00 AM" respectively.

I am getting following expression in "Resulting expression" tab:

DateDiff('dd',01/01/2013 00:00:00,02/04/2013 00:00:00)

Solution

  • When creating the expression you have 2 options on how to insert a document property, one of them is to insert the property as text which is what you have done by entering the expression:

    DateDiff('dd',${startDate},${endDate})
    

    the other option, and the one you need, is to insert the property as a value which is achieved thus:

    DateDiff("dd",DocumentProperty("startDate"),DocumentProperty("endDate"))
    

    If you don't think you'll remember this then you can always right click on the property when creating your expression and the 2 options will be shown to you and inserted automatically depending on your selection:

    Spotfire Custom Expression

    Notice as well that nothing is shown in the Resulting expression box.

    Here is a quick test I done, my date data is Date rather than DateTime but it works just the same:

    Example data

    Further information can be gained in the Spotfire documentation.