Datetime type is not detected in JSON data

Stimulsoft Reports.JS discussion
Post Reply
lega
Posts: 10
Joined: Mon May 29, 2017 12:44 pm

Datetime type is not detected in JSON data

Post by lega »

Reproduction
Create new report
Bind the report to a JSON based dataset having a Date property
Open designer
Add a text element with binding expression that contains Year function passing our Date property.

Current Behavior
In Dictionary view this property datatype will be String
Opening Preview tabs gives "Expression in Text property of 'Text1' can't be evaluated! Parser error: There is no matching overloaded method for 'Year(String)'" warning
Print to PDF fails with "Cannot read property 'replace' of undefined" in console

Expected behavior
DateTime type is detected from JSON data and DateTime functions don't fail report rendering.

The repro in attachment.

To start, run

Code: Select all

node server.js
and navigate to http://127.0.0.1:8081/
Or use your own http server.

Thanks
Attachments
datetime-not-detected.zip
(2.23 MiB) Downloaded 145 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Datetime type is not detected in JSON data

Post by Alex K. »

Hello,

Your column is string and in Year function you should send DateTime. Please try to use the following expression:
{Year(DateTime.Parse(YourColumn))}

Thank you.
Post Reply