Jump to content

Date Document Property as Input for Data On Demand using Expression


Funny Cat
Go to solution Solved by David Boot-Olazabal,

Recommended Posts

Hi,

I wan't to use two document properties of type date as input for a data on demand range using an Expression.

the expression formulas are:

  • If(${cbTimespan}, Date(${fromDate}),DateTimeNow() - Days(${lastXdays}))
  • If(${cbTimespan}, Date(${toDate}),DateTimeNow())

where

  • cbTimespan is a boolean document property
  • fromDate and toDate are date document properties and
  • lastXdays is an integer document property

Unfortunately, when I use the properties in the custom expression, the data on demand doesn't return any data. (If I use the properties fromDate and toDate not in the expression, but directly the information link returns data.

I tried to debug it using a calculated value in a text field and found, that Date(${fromDate}) results in 01.01.0001

 

I'm kind of stuck and would appreciate any hints or solutions.

Thank you!

Link to comment
Share on other sites

  • Solution

Hi,

Can you try to use this option to use Document properties?

  • If(${cbTimespan}, DocumentProperty("fromDate"),DateTimeNow() - Days(${lastXdays}))
  • If(${cbTimespan}, DocumentProperty("toDate"),DateTimeNow())

When you map the document property with ${fromDate} it returns it as a text. Your Date conversion may not be properly working. Therefore, it may be better to use the value directly from the property by using the DocumentProperty("fromDate") option.

If that is not working either, could you share the dxp file?

Kind regards,

David

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...