Skip to main content
Feb 21, 2020 7:47 PM UTC
Solved

parseDate works in service but does not work in subscription

The parseDate function works when I run it in a service for testing purposes, but it does not work when I try to use it in a subscription that calls a service that uses the parseDate function.

Please see below:

 

Working example: Converts PST time to JST time

Thingworx - 2020-02-21 - parseDate working.PNG

 

Not working: Service called by subscription

Thingworx - 2020-02-21 - Service called in subscription.PNG

 

Error: "Invalid format"

Thingworx - 2020-02-21 - parseDate invalid format error.PNG

 

For reference:

https://www.ptc.com/en/support/article/CS219448

https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html

WillieAnswer
Feb 21, 2020 9:36 PM UTC

I found the error....

 

It seems that I was using "eventData" instead of "eventData.newValue.value" as the input in the subscription....

The subscription is triggered based on DataChange.

5 replies

Feb 21, 2020 8:04 PM UTC

It seems to want to 'pass on' time from epoch?

not sure why it works in one and not the other, is there any basetype differences?

WillieAuthor
Feb 21, 2020 9:15 PM UTC

Basetypes of both services:

 

Input: string

Output: TimeStamp

Feb 21, 2020 8:17 PM UTC

Hi @Willie.

 

Which version of ThingWorx are you running? We tested under 8.5.3 and received an unexpected result.  We'll probably need to open an internal case for this.

 

Regards.

 

--Sharon

WillieAuthor
Feb 21, 2020 9:16 PM UTC

I am using thingworx v8.4.5