Skip to main content
16-Pearl
February 21, 2020
Solved

parseDate works in service but does not work in subscription

  • February 21, 2020
  • 2 replies
  • 1808 views

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

Best answer by Willie

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.

2 replies

22-Sapphire I
February 21, 2020

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?

Willie16-PearlAuthor
16-Pearl
February 21, 2020

Basetypes of both services:

 

Input: string

Output: TimeStamp

Support
February 21, 2020

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

Willie16-PearlAuthor
16-Pearl
February 21, 2020

I am using thingworx v8.4.5